本文整理汇总了PHP中Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection::_afterLoad方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractCollection::_afterLoad方法的具体用法?PHP AbstractCollection::_afterLoad怎么用?PHP AbstractCollection::_afterLoad使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
的用法示例。
在下文中一共展示了AbstractCollection::_afterLoad方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _afterLoad
/**
* {@inheritdoc}
*/
protected function _afterLoad()
{
foreach ($this->_items as $item) {
$item->setIndex($this->index);
}
return parent::_afterLoad();
}
示例2: _afterLoad
protected function _afterLoad()
{
parent::_afterLoad();
if ($storeViewId = $this->getStoreViewId()) {
foreach ($this->_items as $item) {
$item->setStoreViewId($storeViewId)->getStoreViewValue();
}
}
return $this;
}
示例3: _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;
}
示例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->getWishlistItemId();
$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;
}
示例5: _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;
}
示例6: _afterLoad
/**
* after collection load
*
* @return $this
*/
protected function _afterLoad()
{
$items = $this->getColumnValues('article_id');
$connection = $this->getConnection();
if (count($items)) {
$select = $connection->select()->from(['article_store' => $this->getTable('gemtoo_blog_article_store')])->where('article_store.article_id IN (?)', $items);
if ($result = $connection->fetchPairs($select)) {
foreach ($this as $item) {
/** @var $item \Gemtoo\Blog\Model\Article */
if (!isset($result[$item->getData('article_id')])) {
continue;
}
$item->setData('store_id', $result[$item->getData('article_id')]);
}
}
}
return parent::_afterLoad();
}
示例7: _afterLoad
/**
* After load collection process
*
* @return $this
*/
protected function _afterLoad()
{
parent::_afterLoad();
\Magento\Framework\Profiler::start('TTT1:' . __METHOD__, ['group' => 'TTT1', 'method' => __METHOD__]);
$this->_addProductAttributes();
\Magento\Framework\Profiler::stop('TTT1:' . __METHOD__);
\Magento\Framework\Profiler::start('TTT2:' . __METHOD__, ['group' => 'TTT2', 'method' => __METHOD__]);
$this->_addAssociatedProductFilters();
\Magento\Framework\Profiler::stop('TTT2:' . __METHOD__);
\Magento\Framework\Profiler::start('TTT3:' . __METHOD__, ['group' => 'TTT3', 'method' => __METHOD__]);
$this->_loadLabels();
\Magento\Framework\Profiler::stop('TTT3:' . __METHOD__);
\Magento\Framework\Profiler::start('TTT4:' . __METHOD__, ['group' => 'TTT4', 'method' => __METHOD__]);
$this->loadOptions();
\Magento\Framework\Profiler::stop('TTT4:' . __METHOD__);
return $this;
}
示例8: _afterLoad
/**
* After collection load
*
* @return $this
*/
protected function _afterLoad()
{
$this->_eventManager->dispatch($this->_eventPrefix . '_load_after', [$this->_eventObject => $this]);
return parent::_afterLoad();
}
示例9: _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();
}
示例10: _afterLoad
/**
* Perform operations after collection load
*
* @return $this
*/
protected function _afterLoad()
{
$this->performAfterLoad('kuzman_product_faq_id', 'question_id', 'product_id');
return parent::_afterLoad();
}
示例11: _afterLoad
/**
* After load processing
*
* @return $this
*/
protected function _afterLoad()
{
parent::_afterLoad();
/**
* Assign products
*/
$this->_assignOptions();
$this->_assignProducts();
$this->resetItemsDataChanged();
$this->getPageSize();
return $this;
}
示例12: _afterLoad
/**
* Perform operations after collection load
*
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
*
* @return $this
*/
protected function _afterLoad()
{
$this->loadStores();
$this->loadTermsData();
return parent::_afterLoad();
}
示例13: _afterLoad
/**
* Perform operations after collection load
*
* @return $this
*/
protected function _afterLoad()
{
$items = $this->getColumnValues('post_id');
if (count($items)) {
$connection = $this->getConnection();
$tableName = $this->getTable('magefan_blog_post_store');
$select = $connection->select()->from(['cps' => $tableName])->where('cps.post_id IN (?)', $items);
$result = $connection->fetchPairs($select);
if ($result) {
foreach ($this as $item) {
$postId = $item->getData('post_id');
if (!isset($result[$postId])) {
continue;
}
if ($result[$postId] == 0) {
$stores = $this->_storeManager->getStores(false, true);
$storeId = current($stores)->getId();
} else {
$storeId = $result[$item->getData('post_id')];
}
$item->setData('_first_store_id', $storeId);
$item->setData('store_ids', [$result[$postId]]);
}
}
if ($this->_storeId) {
foreach ($this as $item) {
$item->setStoreId($this->_storeId);
}
}
$map = ['category' => 'categories', 'tag' => 'tags'];
foreach ($map as $key => $property) {
$tableName = $this->getTable('magefan_blog_post_' . $key);
$select = $connection->select()->from(['cps' => $tableName])->where('cps.post_id IN (?)', $items);
$result = $connection->fetchAll($select);
if ($result) {
$data = [];
foreach ($result as $item) {
$data[$item['post_id']][] = $item[$key . '_id'];
}
foreach ($this as $item) {
$postId = $item->getData('post_id');
if (isset($data[$postId])) {
$item->setData($property, $data[$postId]);
}
}
}
}
}
$this->_previewFlag = false;
return parent::_afterLoad();
}
示例14: _afterLoad
/**
* Perform operations after collection load
*
* @return $this
*/
protected function _afterLoad()
{
$this->performAfterLoad('swissup_easytabs_store', 'tab_id');
return parent::_afterLoad();
}
示例15: _afterLoad
/**
* Perform operations after collection load
*
* @return $this
*/
protected function _afterLoad()
{
$items = $this->getColumnValues('category_id');
if (count($items)) {
$connection = $this->getConnection();
$select = $connection->select()->from(['cps' => $this->getTable('magefan_blog_category_store')])->where('cps.category_id IN (?)', $items);
$result = $connection->fetchPairs($select);
if ($result) {
foreach ($this as $item) {
$categoryId = $item->getData('category_id');
if (!isset($result[$categoryId])) {
continue;
}
if ($result[$categoryId] == 0) {
$stores = $this->_storeManager->getStores(false, true);
$storeId = current($stores)->getId();
$storeCode = key($stores);
} else {
$storeId = $result[$item->getData('category_id')];
$storeCode = $this->_storeManager->getStore($storeId)->getCode();
}
$item->setData('_first_store_id', $storeId);
$item->setData('store_code', $storeCode);
$item->setData('store_id', [$result[$categoryId]]);
}
}
}
$this->_previewFlag = false;
return parent::_afterLoad();
}