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


PHP Model\AbstractExtensibleModel類代碼示例

本文整理匯總了PHP中Magento\Framework\Model\AbstractExtensibleModel的典型用法代碼示例。如果您正苦於以下問題:PHP AbstractExtensibleModel類的具體用法?PHP AbstractExtensibleModel怎麽用?PHP AbstractExtensibleModel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: addCustomAttributesToModel

 /**
  * @param string[] $attributesAsArray
  * @param \Magento\Framework\Model\AbstractExtensibleModel $model
  * @return \Magento\Framework\Api\AttributeInterface[]
  */
 protected function addCustomAttributesToModel($attributesAsArray, $model)
 {
     $addedAttributes = [];
     foreach ($attributesAsArray as $attributeCode => $attributeValue) {
         $addedAttributes[$attributeCode] = new AttributeValue([AttributeValue::ATTRIBUTE_CODE => $attributeCode, AttributeValue::VALUE => $attributeValue]);
     }
     $model->setData(array_merge($model->getData(), [\Magento\Framework\Api\CustomAttributesDataInterface::CUSTOM_ATTRIBUTES => $addedAttributes]));
     return $addedAttributes;
 }
開發者ID:vasiljok,項目名稱:magento2,代碼行數:14,代碼來源:AbstractExtensibleModelTest.php

示例2: afterSave

 /**
  * After save process
  *
  * @return $this
  */
 public function afterSave()
 {
     parent::afterSave();
     $this->_getResource()->saveLabel($this);
     $this->_getResource()->savePrices($this);
     return $this;
 }
開發者ID:opexsw,項目名稱:magento2,代碼行數:12,代碼來源:Attribute.php

示例3: beforeSave

 /**
  * Processing object before save data
  *
  * @return $this
  */
 public function beforeSave()
 {
     if (!$this->getAttributeGroupCode()) {
         $groupName = $this->getAttributeGroupName();
         if ($groupName) {
             $this->setAttributeGroupCode(trim(preg_replace('/[^a-z0-9]+/', '-', strtolower($groupName)), '-'));
         }
     }
     return parent::beforeSave();
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:15,代碼來源:Group.php

示例4: beforeSave

 /**
  * Processing object before save data
  *
  * @return $this
  */
 public function beforeSave()
 {
     if ($this->getContentHeight() == 0) {
         $this->setContentHeight('');
         //converting zero Content-Height
     }
     if ($this->getContentHeight() && !preg_match('/(' . implode("|", $this->allowedCssUnits) . ')/', $this->getContentHeight())) {
         $contentHeight = $this->getContentHeight() . 'px';
         //setting default units for Content-Height
         $this->setContentHeight($contentHeight);
     }
     return parent::beforeSave();
 }
開發者ID:niranjanssiet,項目名稱:magento2,代碼行數:18,代碼來源:Agreement.php

示例5: getData

 /**
  * Retrieve data
  *
  * @param string $key
  * @param mixed $index
  * @return mixed
  */
 public function getData($key = '', $index = null)
 {
     if ('cc_number' === $key) {
         if (empty($this->_data['cc_number']) && !empty($this->_data['cc_number_enc'])) {
             $this->_data['cc_number'] = $this->decrypt($this->getCcNumberEnc());
         }
     }
     if ('cc_cid' === $key) {
         if (empty($this->_data['cc_cid']) && !empty($this->_data['cc_cid_enc'])) {
             $this->_data['cc_cid'] = $this->decrypt($this->getCcCidEnc());
         }
     }
     return parent::getData($key, $index);
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:21,代碼來源:Info.php

示例6: beforeSave

 /**
  * Processing object before save data
  *
  * @return $this
  */
 public function beforeSave()
 {
     if (!$this->getAttributeGroupCode()) {
         $groupName = $this->getAttributeGroupName();
         if ($groupName) {
             $attributeGroupCode = trim(preg_replace('/[^a-z0-9]+/', '-', strtolower($groupName)), '-');
             if (empty($attributeGroupCode)) {
                 // in the following code md5 is not used for security purposes
                 $attributeGroupCode = md5($groupName);
             }
             $this->setAttributeGroupCode($attributeGroupCode);
         }
     }
     return parent::beforeSave();
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:20,代碼來源:Group.php

示例7: beforeDelete

 /**
  * Validate tax class can be deleted
  *
  * @return $this
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function beforeDelete()
 {
     $this->checkClassCanBeDeleted();
     return parent::beforeDelete();
 }
開發者ID:opexsw,項目名稱:magento2,代碼行數:11,代碼來源:ClassModel.php

示例8: __construct

 /**
  * @param \Magento\Framework\Model\Context $context
  * @param \Magento\Framework\Registry $registry
  * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory
  * @param AttributeValueFactory $customAttributeFactory
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
  * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
  * @param array $data
  */
 public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [])
 {
     $this->_storeManager = $storeManager;
     parent::__construct($context, $registry, $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, $data);
     $this->setIncludePath();
 }
開發者ID:stepzerosolutions,項目名稱:cabbybase,代碼行數:16,代碼來源:AbstractModel.php

示例9: afterDelete

 /**
  * Rewrite in order to clear configuration cache
  *
  * @return $this
  */
 public function afterDelete()
 {
     $this->_storeManager->reinitStores();
     parent::afterDelete();
     return $this;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:11,代碼來源:Website.php

示例10: __wakeup

 /**
  * @inheritdoc
  */
 public function __wakeup()
 {
     parent::__wakeup();
     $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
     $this->metadataPool = $objectManager->get(MetadataPool::class);
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:9,代碼來源:Attribute.php

示例11: afterSave

 /**
  * @return \Magento\Framework\Model\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:pradeep-wagento,項目名稱:magento2,代碼行數:17,代碼來源:Option.php

示例12: afterDelete

 /**
  * Rewrite in order to clear configuration cache
  *
  * @return $this
  */
 public function afterDelete()
 {
     parent::afterDelete();
     $this->_configCacheType->clean();
     return $this;
 }
開發者ID:mrbadao,項目名稱:magento-ce,代碼行數:11,代碼來源:Store.php

示例13: __construct

 /**
  * @param \Magento\Framework\Model\Context $context
  * @param \Magento\Framework\Registry $registry
  * @param ExtensionAttributesFactory $extensionFactory
  * @param AttributeValueFactory $customAttributeFactory
  * @param \Magento\Customer\Model\Session $customerSession
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param StockConfigurationInterface $stockConfiguration
  * @param StockRegistryInterface $stockRegistry
  * @param StockItemRepositoryInterface $stockItemRepository
  * @param \Magento\Framework\Model\Resource\AbstractResource $resource
  * @param \Magento\Framework\Data\Collection\Db $resourceCollection
  * @param array $data
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Customer\Model\Session $customerSession, \Magento\Store\Model\StoreManagerInterface $storeManager, StockConfigurationInterface $stockConfiguration, StockRegistryInterface $stockRegistry, StockItemRepositoryInterface $stockItemRepository, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = [])
 {
     parent::__construct($context, $registry, $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, $data);
     $this->customerSession = $customerSession;
     $this->storeManager = $storeManager;
     $this->stockConfiguration = $stockConfiguration;
     $this->stockRegistry = $stockRegistry;
     $this->stockItemRepository = $stockItemRepository;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:24,代碼來源:Item.php

示例14: beforeDelete

 /**
  * @return $this
  */
 public function beforeDelete()
 {
     $this->_configDataResource->clearScopeData(\Magento\Store\Model\ScopeInterface::SCOPE_STORES, $this->getStoreIds());
     return parent::beforeDelete();
 }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:8,代碼來源:Group.php

示例15: __wakeup

 /**
  * @inheritdoc
  */
 public function __wakeup()
 {
     parent::__wakeup();
     $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
     $this->_eavConfig = $objectManager->get(\Magento\Eav\Model\Config::class);
     $this->_eavTypeFactory = $objectManager->get(\Magento\Eav\Model\Entity\TypeFactory::class);
     $this->_storeManager = $objectManager->get(\Magento\Store\Model\StoreManagerInterface::class);
     $this->_resourceHelper = $objectManager->get(\Magento\Eav\Model\ResourceModel\Helper::class);
     $this->_universalFactory = $objectManager->get(\Magento\Framework\Validator\UniversalFactory::class);
     $this->optionDataFactory = $objectManager->get(\Magento\Eav\Api\Data\AttributeOptionInterfaceFactory::class);
     $this->dataObjectProcessor = $objectManager->get(\Magento\Framework\Reflection\DataObjectProcessor::class);
     $this->dataObjectHelper = $objectManager->get(\Magento\Framework\Api\DataObjectHelper::class);
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:16,代碼來源:AbstractAttribute.php


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