/**
  * @param LifecycleEventArgs $args
  */
 public function preRemove(LifecycleEventArgs $args)
 {
     $entity = $args->getEntity();
     try {
         $this->solr->removeDocument($entity);
     } catch (\RuntimeException $e) {
     }
 }
 /**
  * @param LifecycleEventArgs $args
  */
 public function preRemove(LifecycleEventArgs $args)
 {
     try {
         $entity = $args->getEntity();
         $metaInformation = $this->solr->getMetaFactory()->loadInformation($entity);
         $entity = EntityHelper::customizeEntity($entity, $metaInformation);
         $this->solr->removeDocument($entity);
         EntityHelper::normalizationEntity($entity, $metaInformation);
     } catch (\RuntimeException $e) {
     }
 }
Example #3
0
 /**
  * @test
  */
 public function removeDocumentFromAllCores()
 {
     $metaInformation = MetaTestInformationFactory::getMetaInformation();
     $metaInformation->setIndex('*');
     $this->setupMetaFactoryLoadOneCompleteInformation($metaInformation);
     $this->mapper->expects($this->once())->method('toDocument')->will($this->returnValue(new DocumentStub()));
     $this->solrClientFake->expects($this->once())->method('getEndpoints')->will($this->returnValue(array('core0' => array(), 'core1' => array())));
     $deleteQuery = $this->getMock('Solarium\\QueryType\\Update\\Query\\Query', array(), array(), '', false);
     $deleteQuery->expects($this->once())->method('addDeleteQuery')->with($this->isType('string'));
     $deleteQuery->expects($this->once())->method('addCommit');
     $this->solrClientFake->expects($this->once())->method('createUpdate')->will($this->returnValue($deleteQuery));
     $this->solrClientFake->expects($this->exactly(2))->method('update');
     $solr = new Solr($this->solrClientFake, $this->commandFactory, $this->eventDispatcher, $this->metaFactory, $this->mapper);
     $solr->removeDocument(new ValidTestEntity());
 }
 /**
  * @When /^I delete the entity$/
  */
 public function iDeleteTheEntity()
 {
     $this->solr->removeDocument($this->entity);
 }
Example #5
0
 public function testRemoveDocument()
 {
     $this->assertDeleteQueryWasExecuted();
     $this->eventDispatcher->expects($this->exactly(2))->method('dispatch');
     $this->setupMetaFactoryLoadOneCompleteInformation();
     $this->mapper->expects($this->once())->method('toDocument')->will($this->returnValue(new DocumentStub()));
     $solr = new Solr($this->solrClientFake, $this->commandFactory, $this->eventDispatcher, $this->metaFactory, $this->mapper);
     $solr->removeDocument(new ValidTestEntity());
 }