Skip to content

Instantly share code, notes, and snippets.

@mlebkowski
Created February 20, 2014 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlebkowski/9112314 to your computer and use it in GitHub Desktop.
Save mlebkowski/9112314 to your computer and use it in GitHub Desktop.
<?php
function updateSphinxRTIndex($isDelete = false)
{
$indexer = Xplod::getInstance()->getContainer()->get('search.listener.realtime_indexer');
$propelModel = $this->toPropelModel();
if ($this->isNew())
{
$indexer->queueInsert($propelModel);
}
elseif ($isDelete)
{
$indexer->queueDelete($propelModel);
}
else
{
$indexer->queueUpdate($propelModel);
}
$data = $this->getFillData();
if (!empty($data['doctor_id']))
{
$object = ORMDoctorManager::retrieveById($data['doctor_id']);
}
elseif (!empty($data['facility_id']))
{
$object = ORMFacilityManager::retrieveById($data['facility_id']);
}
if ($object)
{
$propelModel = $object->toPropelModel();
$indexer->queueUpdate($propelModel);
}
}
@prgTW
Copy link

prgTW commented Feb 20, 2014

moze miec i doctor_id i facility_id, wiec $object musi byc arayem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment