当前位置: 首页>>代码示例>>PHP>>正文


PHP AbstractModel::afterSave方法代码示例

本文整理汇总了PHP中Magento\Framework\Model\AbstractModel::afterSave方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractModel::afterSave方法的具体用法?PHP AbstractModel::afterSave怎么用?PHP AbstractModel::afterSave使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Model\AbstractModel的用法示例。


在下文中一共展示了AbstractModel::afterSave方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testUpdateStoredData

 public function testUpdateStoredData()
 {
     $this->model->setData(['id' => 1000, 'name' => 'Test Name']);
     $this->assertEmpty($this->model->getStoredData());
     $this->model->afterLoad();
     $this->assertEquals($this->model->getData(), $this->model->getStoredData());
     $this->model->setData('value', 'Test Value');
     $this->model->afterSave();
     $this->assertEquals($this->model->getData(), $this->model->getStoredData());
     $this->model->afterDelete();
     $this->assertEmpty($this->model->getStoredData());
 }
开发者ID:vasiljok,项目名称:magento2,代码行数:12,代码来源:AbstractModelTest.php

示例2: afterSave

 public function afterSave()
 {
     if ($storeViewId = $this->getStoreViewId()) {
         $storeAttributes = $this->getStoreAttributes();
         foreach ($storeAttributes as $attribute) {
             $attributeValue = $this->_valueFactory->create()->loadAttributeValue($this->getId(), $storeViewId, $attribute);
             if ($this->getData($attribute . '_in_store')) {
                 try {
                     if ($attribute == 'image' && $this->getData('delete_image')) {
                         $attributeValue->delete();
                     } else {
                         $attributeValue->setValue($this->getData($attribute . '_value'))->save();
                     }
                 } catch (\Exception $e) {
                     $this->_monolog->addError($e->getMessage());
                 }
             } elseif ($attributeValue && $attributeValue->getId()) {
                 try {
                     $attributeValue->delete();
                 } catch (\Exception $e) {
                     $this->_monolog->addError($e->getMessage());
                 }
             }
         }
     }
     return parent::afterSave();
 }
开发者ID:mrtuvn,项目名称:m2ce.dev,代码行数:27,代码来源:Banner.php

示例3: afterSave

 /**
  * The "After save" actions
  *
  * @return $this
  */
 public function afterSave()
 {
     parent::afterSave();
     if ($this->_oauthData->isCleanupProbability()) {
         $this->getResource()->deleteOldEntries($this->_oauthData->getCleanupExpirationPeriod());
     }
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:Nonce.php

示例4: afterSave

 /**
  * Processing object before save data
  *
  * @return $this
  */
 public function afterSave()
 {
     if (!$this->_catalogData->isPriceGlobal() && $this->getWebsiteId()) {
         $this->getResource()->saveSelectionPrice($this);
         if (!$this->getDefaultPriceScope()) {
             $this->unsSelectionPriceValue();
             $this->unsSelectionPriceType();
         }
     }
     parent::afterSave();
 }
开发者ID:opexsw,项目名称:magento2,代码行数:16,代码来源:Selection.php

示例5: afterSave

 /**
  * Process data after model is saved
  *
  * @return $this
  */
 public function afterSave()
 {
     $this->_role = null;
     return parent::afterSave();
 }
开发者ID:razbakov,项目名称:magento2,代码行数:10,代码来源:User.php

示例6: afterSave

 /**
  * Save item options after item saved
  *
  * @return $this
  */
 public function afterSave()
 {
     $this->saveItemOptions();
     return parent::afterSave();
 }
开发者ID:vasiljok,项目名称:magento2,代码行数:10,代码来源:Item.php

示例7: afterSave

 /**
  * Invalidate related cache if instance contain layout updates
  *
  * @return $this
  */
 public function afterSave()
 {
     if ($this->dataHasChangedFor('page_groups') || $this->dataHasChangedFor('widget_parameters')) {
         $this->_invalidateCache();
     }
     return parent::afterSave();
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:12,代码来源:Instance.php

示例8: afterSave

 /**
  * Process after save operations
  *
  * @return $this
  */
 public function afterSave()
 {
     parent::afterSave();
     $this->invalidateIndex();
     return $this;
 }
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:11,代码来源:Thesaurus.php

示例9: afterSave

 /**
  * {@inheritdoc}
  *
  * {@inheritdoc}. In addition, it sets status 'invalidate' for config caches
  *
  * @return $this
  */
 public function afterSave()
 {
     if ($this->isValueChanged()) {
         $this->cacheTypeList->invalidate(\Magento\Framework\App\Cache\Type\Config::TYPE_IDENTIFIER);
     }
     return parent::afterSave();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:14,代码来源:Value.php

示例10: afterSave

 /**
  * Processing object's after save. Overriden to prevent invalidation of "config" cache tag.
  *
  * @SuppressWarnings(PHPMD.StaticAccess)
  *
  * @return $this
  */
 public function afterSave()
 {
     return \Magento\Framework\Model\AbstractModel::afterSave();
 }
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:11,代码来源:Value.php

示例11: afterSave

 /**
  * Save related items
  *
  * @return $this
  */
 public function afterSave()
 {
     parent::afterSave();
     if (null !== $this->_itemCollection) {
         $this->getItemCollection()->save();
     }
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:Wishlist.php

示例12: afterSave

 /**
  * Processing object after save data
  *
  * @return $this
  */
 public function afterSave()
 {
     $indexer = $this->indexerRegistry->get(self::CUSTOMER_GRID_INDEXER_ID);
     if ($indexer->getState()->getStatus() == StateInterface::STATUS_VALID) {
         $this->_getResource()->addCommitCallback([$this, 'reindex']);
     }
     return parent::afterSave();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:Customer.php

示例13: afterSave

 /**
  * @return AbstractModel
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function afterSave()
 {
     $this->getValueInstance()->unsetValues();
     if (is_array($this->getData('values'))) {
         foreach ($this->getData('values') as $value) {
             $this->getValueInstance()->addValue($value);
         }
         $this->getValueInstance()->setOption($this)->saveValues();
     } elseif ($this->getGroupByType($this->getType()) == self::OPTION_GROUP_SELECT) {
         throw new LocalizedException(__('Select type options required values rows.'));
     }
     return parent::afterSave();
 }
开发者ID:opexsw,项目名称:magento2,代码行数:17,代码来源:Option.php

示例14: afterSave

 /**
  * {@inheritdoc}
  */
 public function afterSave()
 {
     $customerData = (array) $this->getData();
     $customerData[CustomerData::ID] = $this->getId();
     $dataObject = $this->customerDataFactory->create();
     $this->dataObjectHelper->populateWithArray($dataObject, $customerData, '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
     $customerOrigData = (array) $this->getOrigData();
     $customerOrigData[CustomerData::ID] = $this->getId();
     $origDataObject = $this->customerDataFactory->create();
     $this->dataObjectHelper->populateWithArray($origDataObject, $customerOrigData, '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
     $this->_eventManager->dispatch('customer_save_after_data_object', ['customer_data_object' => $dataObject, 'orig_customer_data_object' => $origDataObject]);
     return parent::afterSave();
 }
开发者ID:niranjanssiet,项目名称:magento2,代码行数:16,代码来源:Customer.php

示例15: afterSave

 /**
  * {@inheritdoc}
  * @return $this
  */
 public function afterSave()
 {
     $this->getIndexInstance()->afterModelSave();
     return parent::afterSave();
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:9,代码来源:Index.php


注:本文中的Magento\Framework\Model\AbstractModel::afterSave方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。