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


PHP DataObject::getAttributeSetId方法代码示例

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


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

示例1: getLoadAllAttributesCacheSuffix

 /**
  * @param DataObject|null $object
  * @return string
  */
 private function getLoadAllAttributesCacheSuffix(DataObject $object = null)
 {
     $attributeSetId = 0;
     $storeId = 0;
     if (null !== $object) {
         $attributeSetId = $object->getAttributeSetId() ?: $attributeSetId;
         $storeId = $object->getStoreId() ?: $storeId;
     }
     $suffix = $storeId . '-' . $attributeSetId;
     return $suffix;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:15,代码来源:AttributeLoader.php

示例2: _getLoadAttributesSelect

 /**
  * Retrieve select object for loading entity attributes values
  * Join attribute store value
  *
  * @param \Magento\Framework\DataObject $object
  * @param string $table
  * @return \Magento\Framework\DB\Select
  */
 protected function _getLoadAttributesSelect($object, $table)
 {
     /**
      * This condition is applicable for all cases when we was work in not single
      * store mode, customize some value per specific store view and than back
      * to single store mode. We should load correct values
      */
     if ($this->_storeManager->hasSingleStore()) {
         $storeId = (int) $this->_storeManager->getStore(true)->getId();
     } else {
         $storeId = (int) $object->getStoreId();
     }
     $setId = $object->getAttributeSetId();
     $storeIds = [$this->getDefaultStoreId()];
     if ($storeId != $this->getDefaultStoreId()) {
         $storeIds[] = $storeId;
     }
     $select = $this->getConnection()->select()->from(['attr_table' => $table], [])->where("attr_table.{$this->getEntityIdField()} = ?", $object->getId())->where('attr_table.store_id IN (?)', $storeIds);
     if ($setId) {
         $select->join(['set_table' => $this->getTable('eav_entity_attribute')], $this->getConnection()->quoteInto('attr_table.attribute_id = set_table.attribute_id' . ' AND set_table.attribute_set_id = ?', $setId), []);
     }
     return $select;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:31,代码来源:AbstractResource.php

示例3: getEntityAttributeCodes

 /**
  * Get codes of all entity type attributes
  *
  * @param  mixed $entityType
  * @param  \Magento\Framework\DataObject $object
  * @return array
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function getEntityAttributeCodes($entityType, $object = null)
 {
     $entityType = $this->getEntityType($entityType);
     $attributeSetId = 0;
     $storeId = 0;
     if ($object instanceof \Magento\Framework\DataObject) {
         $attributeSetId = $object->getAttributeSetId() ?: $attributeSetId;
         $storeId = $object->getStoreId() ?: $storeId;
     }
     $cacheKey = self::ATTRIBUTES_CODES_CACHE_ID . $entityType->getId() . '-' . $storeId . '-' . $attributeSetId;
     if (isset($this->_attributeCodes[$cacheKey])) {
         return $this->_attributeCodes[$cacheKey];
     }
     if ($this->isCacheEnabled() && ($attributes = $this->_cache->load($cacheKey))) {
         $this->_attributeCodes[$cacheKey] = unserialize($attributes);
         return $this->_attributeCodes[$cacheKey];
     }
     if ($attributeSetId) {
         $attributesInfo = $this->_universalFactory->create($entityType->getEntityAttributeCollection())->setEntityTypeFilter($entityType)->setAttributeSetFilter($attributeSetId)->addStoreLabel($storeId)->getData();
         $attributes = [];
         foreach ($attributesInfo as $attributeData) {
             $attributes[] = $attributeData['attribute_code'];
             $this->_createAttribute($entityType, $attributeData);
         }
     } else {
         $this->_initAttributes($entityType);
         $attributes = array_keys($this->_attributeData[$entityType->getEntityTypeCode()]);
     }
     $this->_attributeCodes[$cacheKey] = $attributes;
     if ($this->isCacheEnabled()) {
         $this->_cache->save(serialize($attributes), $cacheKey, [\Magento\Eav\Model\Cache\Type::CACHE_TAG, \Magento\Eav\Model\Entity\Attribute::CACHE_TAG]);
     }
     return $attributes;
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:43,代码来源:Config.php


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