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


PHP AbstractAttribute::getBackendTable方法代码示例

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


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

示例1: prepareValue

 /**
  * @param string $entityType
  * @param string $value
  * @param AbstractAttribute $attribute
  * @return string
  * @throws \Exception
  */
 protected function prepareValue($entityType, $value, AbstractAttribute $attribute)
 {
     $metadata = $this->metadataPool->getMetadata($entityType);
     $type = $attribute->getBackendType();
     if (($type == 'int' || $type == 'decimal' || $type == 'datetime') && $value === '') {
         $value = null;
     } elseif ($type == 'decimal') {
         $value = $this->localeFormat->getNumber($value);
     }
     $describe = $metadata->getEntityConnection()->describeTable($attribute->getBackendTable());
     return $metadata->getEntityConnection()->prepareColumnValue($describe['value'], $value);
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:19,代码来源:AttributePersistor.php

示例2: _prepareValueForSave

 /**
  * Prepare value for save
  *
  * @param mixed $value
  * @param AbstractAttribute $attribute
  * @return mixed
  */
 protected function _prepareValueForSave($value, AbstractAttribute $attribute)
 {
     $type = $attribute->getBackendType();
     if (($type == 'int' || $type == 'decimal' || $type == 'datetime') && $value === '') {
         $value = null;
     } elseif ($type == 'decimal') {
         $value = $this->_localeFormat->getNumber($value);
     }
     $backendTable = $attribute->getBackendTable();
     if (!isset(self::$_attributeBackendTables[$backendTable])) {
         self::$_attributeBackendTables[$backendTable] = $this->_getReadAdapter()->describeTable($backendTable);
     }
     $describe = self::$_attributeBackendTables[$backendTable];
     return $this->_getReadAdapter()->prepareColumnValue($describe['value'], $value);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:22,代码来源:AbstractEntity.php

示例3: getAttributeOptions

 /**
  * Load options for attribute
  *
  * @param \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $superAttribute
  * @param int $productId
  * @return array
  */
 public function getAttributeOptions($superAttribute, $productId)
 {
     $scope = $this->getScopeResolver()->getScope();
     $select = $this->getConnection()->select()->from(['super_attribute' => $this->getTable('catalog_product_super_attribute')], ['sku' => 'entity.sku', 'product_id' => 'product_entity.entity_id', 'attribute_code' => 'attribute.attribute_code', 'value_index' => 'entity_value.value', 'option_title' => $this->getConnection()->getIfNullSql('option_value.value', 'default_option_value.value'), 'default_title' => 'default_option_value.value'])->joinInner(['product_entity' => $this->getTable('catalog_product_entity')], "product_entity.{$this->getProductEntityLinkField()} = super_attribute.product_id", [])->joinInner(['product_link' => $this->getTable('catalog_product_super_link')], 'product_link.parent_id = super_attribute.product_id', [])->joinInner(['attribute' => $this->getTable('eav_attribute')], 'attribute.attribute_id = super_attribute.attribute_id', [])->joinInner(['entity' => $this->getTable('catalog_product_entity')], 'entity.entity_id = product_link.product_id', [])->joinInner(['entity_value' => $superAttribute->getBackendTable()], implode(' AND ', ['entity_value.attribute_id = super_attribute.attribute_id', 'entity_value.store_id = 0', "entity_value.{$this->getProductEntityLinkField()} = " . "entity.{$this->getProductEntityLinkField()}"]), [])->joinLeft(['option_value' => $this->getTable('eav_attribute_option_value')], implode(' AND ', ['option_value.option_id = entity_value.value', 'option_value.store_id = ' . $scope->getId()]), [])->joinLeft(['default_option_value' => $this->getTable('eav_attribute_option_value')], implode(' AND ', ['default_option_value.option_id = entity_value.value', 'default_option_value.store_id = ' . \Magento\Store\Model\Store::DEFAULT_STORE_ID]), [])->where('super_attribute.product_id = ?', $productId)->where('attribute.attribute_id = ?', $superAttribute->getAttributeId());
     return $this->getConnection()->fetchAll($select);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:13,代码来源:Configurable.php


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