Example #1
0
 /**
  * Set store id for each collection item when collection was loaded
  *
  * @return $this
  */
 public function _afterLoad()
 {
     parent::_afterLoad();
     if ($this->getStoreId() && $this->_items) {
         foreach ($this->_items as $item) {
             $item->setStoreId($this->getStoreId());
         }
     }
     return $this;
 }
Example #2
0
 /**
  * @SuppressWarnings(PHPMD.CamelCaseMethodName)
  *
  * {@inheritDoc}
  */
 protected function _afterLoad()
 {
     // Resort items according the search response.
     $orginalItems = $this->_items;
     $this->_items = [];
     foreach ($this->queryResponse->getIterator() as $document) {
         $documentId = $document->getId();
         if (isset($orginalItems[$documentId])) {
             $orginalItems[$documentId]->setDocumentScore($document->getScore());
             $orginalItems[$documentId]->setDocumentSource($document->getSource());
             $this->_items[$documentId] = $orginalItems[$documentId];
         }
     }
     return parent::_afterLoad();
 }
 /**
  * Action after load
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     parent::_afterLoad();
     if ($this->_addStoreDataFlag) {
         $this->_addStoreData();
     }
     return $this;
 }