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