當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。