/** * @param LifecycleEventArgs $args */ public function postUpdate(LifecycleEventArgs $args) { $entity = $args->getEntity(); try { if ($this->hasChanged($args) === false) { return; } $this->solr->updateDocument($entity); } catch (\RuntimeException $e) { $this->logger->debug($e->getMessage()); } }
/** * @param LifecycleEventArgs $args */ public function postUpdate(LifecycleEventArgs $args) { $document = $args->getDocument(); try { $doctrineChangeSet = $args->getDocumentManager()->getUnitOfWork()->getDocumentChangeSet($document); if (count($this->solr->computeChangeSet($doctrineChangeSet, $document)) === 0) { return; } $this->solr->updateDocument($document); } catch (\RuntimeException $e) { $this->logger->debug($e->getMessage()); } }