當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AbstractCollection::_afterLoad方法代碼示例

本文整理匯總了PHP中Magento\Framework\Model\Resource\Db\Collection\AbstractCollection::_afterLoad方法的典型用法代碼示例。如果您正苦於以下問題:PHP AbstractCollection::_afterLoad方法的具體用法?PHP AbstractCollection::_afterLoad怎麽用?PHP AbstractCollection::_afterLoad使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\Model\Resource\Db\Collection\AbstractCollection的用法示例。


在下文中一共展示了AbstractCollection::_afterLoad方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _afterLoad

 /**
  * Unserialize additional_information in each item
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     foreach ($this->_items as $item) {
         $this->getResource()->unserializeFields($item);
     }
     return parent::_afterLoad();
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:12,代碼來源:Collection.php

示例2: _afterLoad

 /**
  * Add website ids to rules data
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     parent::_afterLoad();
     if ($this->getFlag('add_websites_to_result') && $this->_items) {
         /** @var \Magento\Rule\Model\AbstractModel $item */
         foreach ($this->_items as $item) {
             $item->afterLoad();
         }
     }
     return $this;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:16,代碼來源:AbstractCollection.php

示例3: _afterLoad

 /**
  * Set parent items
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     parent::_afterLoad();
     /**
      * Assign parent items
      */
     foreach ($this as $item) {
         if ($item->getParentItemId()) {
             $item->setParentItem($this->getItemById($item->getParentItemId()));
         }
     }
     return $this;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:18,代碼來源:Collection.php

示例4: _afterLoad

 /**
  * Fill array of options by item and product
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     parent::_afterLoad();
     foreach ($this as $option) {
         $optionId = $option->getId();
         $itemId = $option->getItemId();
         $productId = $option->getProductId();
         if (isset($this->_optionsByItem[$itemId])) {
             $this->_optionsByItem[$itemId][] = $optionId;
         } else {
             $this->_optionsByItem[$itemId] = [$optionId];
         }
         if (isset($this->_optionsByProduct[$productId])) {
             $this->_optionsByProduct[$productId][] = $optionId;
         } else {
             $this->_optionsByProduct[$productId] = [$optionId];
         }
     }
     return $this;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:25,代碼來源:Collection.php

示例5: _afterLoad

 /**
  * After load collection process
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     parent::_afterLoad();
     \Magento\Framework\Profiler::start('TTT1:' . __METHOD__, array('group' => 'TTT1', 'method' => __METHOD__));
     $this->_addProductAttributes();
     \Magento\Framework\Profiler::stop('TTT1:' . __METHOD__);
     \Magento\Framework\Profiler::start('TTT2:' . __METHOD__, array('group' => 'TTT2', 'method' => __METHOD__));
     $this->_addAssociatedProductFilters();
     \Magento\Framework\Profiler::stop('TTT2:' . __METHOD__);
     \Magento\Framework\Profiler::start('TTT3:' . __METHOD__, array('group' => 'TTT3', 'method' => __METHOD__));
     $this->_loadLabels();
     \Magento\Framework\Profiler::stop('TTT3:' . __METHOD__);
     \Magento\Framework\Profiler::start('TTT4:' . __METHOD__, array('group' => 'TTT4', 'method' => __METHOD__));
     $this->_loadPrices();
     \Magento\Framework\Profiler::stop('TTT4:' . __METHOD__);
     return $this;
 }
開發者ID:pavelnovitsky,項目名稱:magento2,代碼行數:22,代碼來源:Collection.php

示例6: _afterLoad

 /**
  * Perform operations after collection load
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     $items = $this->getColumnValues('page_id');
     if (count($items)) {
         $connection = $this->getConnection();
         $select = $connection->select()->from(['cps' => $this->getTable('cms_page_store')])->where('cps.page_id IN (?)', $items);
         $result = $connection->fetchPairs($select);
         if ($result) {
             foreach ($this as $item) {
                 $pageId = $item->getData('page_id');
                 if (!isset($result[$pageId])) {
                     continue;
                 }
                 if ($result[$pageId] == 0) {
                     $stores = $this->_storeManager->getStores(false, true);
                     $storeId = current($stores)->getId();
                     $storeCode = key($stores);
                 } else {
                     $storeId = $result[$item->getData('page_id')];
                     $storeCode = $this->_storeManager->getStore($storeId)->getCode();
                 }
                 $item->setData('_first_store_id', $storeId);
                 $item->setData('store_code', $storeCode);
                 $item->setData('store_id', [$result[$pageId]]);
             }
         }
     }
     $this->_previewFlag = false;
     return parent::_afterLoad();
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:35,代碼來源:Collection.php

示例7: _afterLoad

 /**
  * Redeclare after load method for dispatch event
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     parent::_afterLoad();
     $this->_eventManager->dispatch($this->_eventPrefix . '_load_after', array($this->_eventObject => $this));
     return $this;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:11,代碼來源:Collection.php

示例8: _afterLoad

 /**
  * After collection load
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     $this->_eventManager->dispatch($this->_eventPrefix . '_load_after', [$this->_eventObject => $this]);
     return parent::_afterLoad();
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:10,代碼來源:Collection.php

示例9: _afterLoad

 /**
  * After load processing
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     parent::_afterLoad();
     /**
      * Assign products
      */
     $this->_assignOptions();
     $this->_assignProducts();
     $this->resetItemsDataChanged();
     $this->getPageSize();
     return $this;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:17,代碼來源:Collection.php

示例10: _afterLoad

 /**
  * Add data fetched from another database
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     parent::_afterLoad();
     $items = $this->getItems();
     $productIds = [];
     foreach ($items as $item) {
         $productIds[] = $item->getProductId();
     }
     $productData = $this->getProductData($productIds);
     $orderData = $this->getOrdersData($productIds);
     foreach ($items as $item) {
         $item->setId($item->getProductId());
         $item->setPrice($productData[$item->getProductId()]['price'] * $item->getBaseToGlobalRate());
         $item->setName($productData[$item->getProductId()]['name']);
         $item->setOrders(0);
         if (isset($orderData[$item->getProductId()])) {
             $item->setOrders($orderData[$item->getProductId()]['orders']);
         }
     }
     return $this;
 }
開發者ID:nja78,項目名稱:magento2,代碼行數:26,代碼來源:Collection.php

示例11: _afterLoad

 /**
  * after collection load
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     $items = $this->getColumnValues('author_id');
     $connection = $this->getConnection();
     if (count($items)) {
         $select = $connection->select()->from(['author_store' => $this->getTable('sample_news_author_store')])->where('author_store.author_id IN (?)', $items);
         if ($result = $connection->fetchPairs($select)) {
             foreach ($this as $item) {
                 /** @var $item \Sample\News\Model\Author */
                 if (!isset($result[$item->getData('author_id')])) {
                     continue;
                 }
                 $item->setData('store_id', $result[$item->getData('author_id')]);
             }
         }
     }
     return parent::_afterLoad();
 }
開發者ID:nhc,項目名稱:Magento2SampleModule,代碼行數:23,代碼來源:Collection.php


注:本文中的Magento\Framework\Model\Resource\Db\Collection\AbstractCollection::_afterLoad方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。