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


PHP AbstractAttribute::getId方法代码示例

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


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

示例1: deleteProductData

 /**
  * Delete product data
  *
  * @param \Magento\Catalog\Model\Product $product
  * @param \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute
  * @return $this
  */
 public function deleteProductData($product, $attribute)
 {
     $where = ['entity_id = ?' => (int) $product->getId(), 'attribute_id = ?' => (int) $attribute->getId()];
     $connection = $this->getConnection();
     if (!$attribute->isScopeGlobal()) {
         $storeId = $product->getStoreId();
         if ($storeId) {
             $where['website_id IN(?)'] = [0, $this->_storeManager->getStore($storeId)->getWebsiteId()];
         }
     }
     $connection->delete($this->getMainTable(), $where);
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:20,代码来源:Tax.php

示例2: deleteProductData

 /**
  * Delete product data
  *
  * @param \Magento\Catalog\Model\Product $product
  * @param \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute
  * @return $this
  */
 public function deleteProductData($product, $attribute)
 {
     $where = array('entity_id = ?' => (int) $product->getId(), 'attribute_id = ?' => (int) $attribute->getId());
     $adapter = $this->_getWriteAdapter();
     if (!$attribute->isScopeGlobal()) {
         $storeId = $product->getStoreId();
         if ($storeId) {
             $where['website_id IN(?)'] = array(0, $this->_storeManager->getStore($storeId)->getWebsiteId());
         }
     }
     $adapter->delete($this->getMainTable(), $where);
     return $this;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:20,代码来源:Tax.php

示例3: getFlatUpdateSelect

 /**
  * Retrieve Select for update Flat data
  *
  * @param \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute
  * @param int $store
  * @param bool $hasValueField flag which require option value
  * @return \Magento\Framework\DB\Select
  */
 public function getFlatUpdateSelect(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute, $store, $hasValueField = true)
 {
     $adapter = $this->_getReadAdapter();
     $attributeTable = $attribute->getBackend()->getTable();
     $attributeCode = $attribute->getAttributeCode();
     $joinConditionTemplate = "%s.entity_id = %s.entity_id" . " AND %s.entity_type_id = " . $attribute->getEntityTypeId() . " AND %s.attribute_id = " . $attribute->getId() . " AND %s.store_id = %d";
     $joinCondition = sprintf($joinConditionTemplate, 'e', 't1', 't1', 't1', 't1', \Magento\Store\Model\Store::DEFAULT_STORE_ID);
     if ($attribute->getFlatAddChildData()) {
         $joinCondition .= ' AND e.child_id = t1.entity_id';
     }
     $valueExpr = $adapter->getCheckSql('t2.value_id > 0', 't2.value', 't1.value');
     /** @var $select \Magento\Framework\DB\Select */
     $select = $adapter->select()->joinLeft(['t1' => $attributeTable], $joinCondition, [])->joinLeft(['t2' => $attributeTable], sprintf($joinConditionTemplate, 't1', 't2', 't2', 't2', 't2', $store), [$attributeCode => $valueExpr]);
     if ($attribute->getFrontend()->getInputType() != 'multiselect' && $hasValueField) {
         $valueIdExpr = $adapter->getCheckSql('to2.value_id > 0', 'to2.value', 'to1.value');
         $select->joinLeft(['to1' => $this->getTable('eav_attribute_option_value')], "to1.option_id = {$valueExpr} AND to1.store_id = 0", [])->joinLeft(['to2' => $this->getTable('eav_attribute_option_value')], $adapter->quoteInto("to2.option_id = {$valueExpr} AND to2.store_id = ?", $store), [$attributeCode . '_value' => $valueIdExpr]);
     }
     if ($attribute->getFlatAddChildData()) {
         $select->where('e.is_child = 0');
     }
     return $select;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:30,代码来源:Option.php

示例4: _saveAttribute

 /**
  * Save entity attribute value
  *
  * Collect for mass save
  *
  * @param \Magento\Framework\Model\AbstractModel $object
  * @param AbstractAttribute $attribute
  * @param mixed $value
  * @return $this
  */
 protected function _saveAttribute($object, $attribute, $value)
 {
     $table = $attribute->getBackend()->getTable();
     if (!isset($this->_attributeValuesToSave[$table])) {
         $this->_attributeValuesToSave[$table] = array();
     }
     $entityIdField = $attribute->getBackend()->getEntityIdField();
     $data = array('entity_type_id' => $object->getEntityTypeId(), $entityIdField => $object->getId(), 'attribute_id' => $attribute->getId(), 'value' => $this->_prepareValueForSave($value, $attribute));
     $this->_attributeValuesToSave[$table][] = $data;
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:21,代码来源:AbstractEntity.php

示例5: getAttributeRow

 /**
  * Return attribute row to prepare where statement
  *
  * @param \Magento\Framework\Object $entity
  * @param \Magento\Framework\Object $object
  * @param \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute
  * @return array
  */
 protected function getAttributeRow($entity, $object, $attribute)
 {
     $data = ['attribute_id' => $attribute->getId(), $entity->getEntityIdField() => $object->getData($entity->getEntityIdField())];
     if (!$this->getEntityTable()) {
         $data['entity_type_id'] = $entity->getTypeId();
     }
     return $data;
 }
开发者ID:opexsw,项目名称:magento2,代码行数:16,代码来源:AbstractEntity.php

示例6: getFlatUpdateSelect

 /**
  * Retrieve Select For Flat Attribute update
  *
  * @param AbstractAttribute $attribute
  * @param int $storeId
  * @return Select
  */
 public function getFlatUpdateSelect(AbstractAttribute $attribute, $storeId)
 {
     $connection = $this->getConnection();
     $joinConditionTemplate = "%s.entity_id=%s.entity_id" . " AND %s.entity_type_id = " . $attribute->getEntityTypeId() . " AND %s.attribute_id = " . $attribute->getId() . " AND %s.store_id = %d";
     $joinCondition = sprintf($joinConditionTemplate, 'e', 't1', 't1', 't1', 't1', \Magento\Store\Model\Store::DEFAULT_STORE_ID);
     if ($attribute->getFlatAddChildData()) {
         $joinCondition .= ' AND e.child_id = t1.entity_id';
     }
     $valueExpr = $connection->getCheckSql('t2.value_id > 0', 't2.value', 't1.value');
     /** @var $select Select */
     $select = $connection->select()->joinLeft(['t1' => $attribute->getBackend()->getTable()], $joinCondition, [])->joinLeft(['t2' => $attribute->getBackend()->getTable()], sprintf($joinConditionTemplate, 't1', 't2', 't2', 't2', 't2', $storeId), [$attribute->getAttributeCode() => $valueExpr]);
     if ($attribute->getFlatAddChildData()) {
         $select->where("e.is_child = ?", 0);
     }
     return $select;
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:23,代码来源:Attribute.php

示例7: duplicate

 /**
  * @param \Magento\Catalog\Model\Product $product
  * @param AbstractAttribute $attribute
  * @return $this
  */
 protected function duplicate($product, $attribute)
 {
     $mediaGalleryData = $product->getData($attribute->getAttributeCode());
     if (!isset($mediaGalleryData['images']) || !is_array($mediaGalleryData['images'])) {
         return $this;
     }
     $this->getResource()->duplicate($attribute->getId(), isset($mediaGalleryData['duplicate']) ? $mediaGalleryData['duplicate'] : [], $product->getOriginalId(), $product->getId());
     return $this;
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:14,代码来源:Media.php


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