/**
  * @param LifecycleEventArgs $args
  */
 public function postUpdate(LifecycleEventArgs $args)
 {
     $entity = $args->getEntity();
     try {
         $this->solr->updateDocument($entity);
     } catch (\RuntimeException $e) {
     }
 }
 /**
  * @param LifecycleEventArgs $args
  */
 public function postUpdate(LifecycleEventArgs $args)
 {
     try {
         $entity = $args->getEntity();
         $metaInformation = $this->solr->getMetaFactory()->loadInformation($entity);
         $entity = EntityHelper::customizeEntity($entity, $metaInformation);
         $this->solr->updateDocument($entity);
         EntityHelper::normalizationEntity($entity, $metaInformation);
     } catch (\RuntimeException $e) {
     }
 }
Example #3
0
 public function testDoNotUpdateDocumentIfDocumentCallbackAvoidIt()
 {
     $this->eventDispatcher->expects($this->never())->method('dispatch');
     $this->assertUpdateQueryWasNotExecuted();
     $information = new MetaInformation();
     $information->setSynchronizationCallback('shouldBeIndex');
     $this->setupMetaFactoryLoadOneCompleteInformation($information);
     $filteredEntity = new ValidTestEntityFiltered();
     $filteredEntity->shouldIndex = false;
     $solr = new Solr($this->solrClientFake, $this->commandFactory, $this->eventDispatcher, $this->metaFactory, $this->mapper);
     $solr->updateDocument($filteredEntity);
 }
 /**
  * @test
  */
 public function updateDocumentInAllCores()
 {
     $updateQuery = $this->assertUpdateQueryExecuted();
     $this->eventDispatcher->expects($this->exactly(2))->method('dispatch');
     $this->mapOneDocument();
     $this->solrClientFake->expects($this->once())->method('getEndpoints')->will($this->returnValue(array('core0' => array(), 'core1' => array())));
     $this->solrClientFake->expects($this->at(2))->method('update')->with($updateQuery, 'core0');
     $this->solrClientFake->expects($this->at(3))->method('update')->with($updateQuery, 'core1');
     $metaInformation = MetaTestInformationFactory::getMetaInformation();
     $metaInformation->setIndex('*');
     $this->setupMetaFactoryLoadOneCompleteInformation($metaInformation);
     $solr = new Solr($this->solrClientFake, $this->commandFactory, $this->eventDispatcher, $this->metaFactory, $this->mapper);
     $solr->updateDocument(new ValidTestEntity());
 }