コード例 #1
0
 /**
  * Persist scheduled objects to ElasticSearch
  * After persisting, clear the scheduled queue to prevent multiple data updates when using multiple flush calls
  */
 private function persistScheduled()
 {
     /*if (count($this->scheduledForInsertion)) {
           $this->objectPersister->insertMany($this->scheduledForInsertion);
           $this->scheduledForInsertion = array();
       }
       if (count($this->scheduledForUpdate)) {
           $this->objectPersister->replaceMany($this->scheduledForUpdate);
           $this->scheduledForUpdate = array();
       }
       if (count($this->scheduledForDeletion)) {
           $this->objectPersister->deleteManyByIdentifiers($this->scheduledForDeletion);
           $this->scheduledForDeletion = array();
       }*/
     if ($this->shouldPersist()) {
         if (count($this->scheduledForInsertion)) {
             $this->objectPersister->insertMany($this->scheduledForInsertion);
             $this->scheduledForInsertion = array();
         }
         if (count($this->scheduledForUpdate)) {
             $this->objectPersister->replaceMany($this->scheduledForUpdate);
             $this->scheduledForUpdate = array();
         }
         if (count($this->scheduledForDeletion)) {
             $this->objectPersister->deleteManyByIdentifiers($this->scheduledForDeletion);
             $this->scheduledForDeletion = array();
         }
     }
 }
コード例 #2
0
 /**
  * @param PostFlushEventArgs $args
  */
 public function postFlush(PostFlushEventArgs $args)
 {
     if (!empty($this->scheduledForUpdate)) {
         $this->objectPersister->replaceMany($this->scheduledForUpdate);
     }
 }
コード例 #3
0
 public function onFlush()
 {
     if (!empty($this->scheduledForUpdate)) {
         $this->objectPersister->replaceMany($this->scheduledForUpdate);
     }
 }