当前位置: 首页>>代码示例>>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;未经允许,请勿转载。