src/wcmf/lib/search/impl/LuceneSearch.php
public function afterCommit(TransactionEvent $event) {
    if ($this->liveUpdate && $event->getPhase() == TransactionEvent::AFTER_COMMIT) {
      $persistenceFacade = ObjectFactory::getInstance('persistenceFacade');
      // add inserted/updated objects
      foreach (array_merge(array_values($event->getInsertedOids()), $event->getUpdatedOids()) as $oid) {
        $object = $persistenceFacade->load(ObjectId::parse($oid));
        if ($object) {
          $this->addToIndex($object);
        }
        else {
          self::$logger->warn("Could not index object with oid ".$oid." because it does not exist");
        }
      }
      // remove deleted objects
      foreach ($event->getDeletedOids() as $oid) {
        $this->deleteFromIndex(ObjectId::parse($oid));
      }
    }
  }
public function afterCommit(TransactionEvent $event) {
    if ($this->liveUpdate && $event->getPhase() == TransactionEvent::AFTER_COMMIT) {
      $persistenceFacade = ObjectFactory::getInstance('persistenceFacade');
      // add inserted/updated objects
      foreach (array_merge(array_values($event->getInsertedOids()), $event->getUpdatedOids()) as $oid) {
        $object = $persistenceFacade->load(ObjectId::parse($oid));
        if ($object) {
          $this->addToIndex($object);
        }
        else {
          self::$logger->warn("Could not index object with oid ".$oid." because it does not exist");
        }
      }
      // remove deleted objects
      foreach ($event->getDeletedOids() as $oid) {
        $this->deleteFromIndex(ObjectId::parse($oid));
      }
    }
  }
public function afterCommit ( TransactionEvent $ event ) { if ( $ this -> liveUpdate && $ event -> getPhase ( ) == TransactionEvent :: AFTER_COMMIT ) { $ persistenceFacade = ObjectFactory :: getInstance ( 'persistenceFacade' ) ; // add inserted/updated objects foreach ( array_merge ( array_values ( $ event -> getInsertedOids ( ) ) , $ event -> getUpdatedOids ( ) ) as $ oid ) { $ object = $ persistenceFacade -> load ( ObjectId :: parse ( $ oid ) ) ; if ( $ object ) { $ this -> addToIndex ( $ object ) ; } else { self :: $ logger -> warn ( "Could not index object with oid " . $ oid . " because it does not exist" ) ; } } // remove deleted objects foreach ( $ event -> getDeletedOids ( ) as $ oid ) { $ this -> deleteFromIndex ( ObjectId :: parse ( $ oid ) ) ; } } }
Listen to TransactionEvents
@param $event TransactionEvent instance
Listen to TransactionEvents