/**
  * @param LifecycleEventArgs $args
  */
 public function postPersist(LifecycleEventArgs $args)
 {
     $entity = $args->getDocument();
     try {
         $this->solr->addDocument($entity);
     } catch (\RuntimeException $e) {
     }
 }
 /**
  * @param LifecycleEventArgs $args
  */
 public function postPersist(LifecycleEventArgs $args)
 {
     try {
         $entity = $args->getEntity();
         $metaInformation = $this->solr->getMetaFactory()->loadInformation($entity);
         $entity = EntityHelper::customizeEntity($entity, $metaInformation);
         $this->solr->addDocument($entity);
         EntityHelper::normalizationEntity($entity, $metaInformation);
     } catch (\RuntimeException $e) {
     }
 }
 /**
  * @test
  */
 public function addDocumentToAllCores()
 {
     $updateQuery = $this->assertUpdateQueryExecuted();
     $this->eventDispatcher->expects($this->any())->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->addDocument(new ValidTestEntity());
 }
 /**
  * @When /^I add these entities to Solr$/
  */
 public function iAddThisEntityToSolr()
 {
     foreach ($this->entities as $entity) {
         $this->solr->addDocument($entity);
     }
 }
 /**
  * @When /^I add this entity to Solr$/
  */
 public function iAddThisEntityToSolr()
 {
     $this->solr->addDocument($this->entity);
 }
Beispiel #6
0
 /**
  * @expectedException \BadMethodCallException
  */
 public function testAddEntity_FilteredEntityWithUnknownCallback()
 {
     $this->assertUpdateQueryWasNotExecuted();
     $this->eventDispatcher->expects($this->never())->method('dispatch');
     $information = MetaTestInformationFactory::getMetaInformation();
     $information->setSynchronizationCallback('shouldBeIndex');
     $this->setupMetaFactoryLoadOneCompleteInformation($information);
     $solr = new Solr($this->solrClientFake, $this->commandFactory, $this->eventDispatcher, $this->metaFactory, $this->mapper);
     $solr->addDocument(new InvalidTestEntityFiltered());
 }