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


PHP AbstractModel::getEntityAttributeId方法代码示例

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


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

示例1: deleteEntity

 /**
  * Delete entity
  *
  * @param \Magento\Framework\Model\AbstractModel $object
  * @return $this
  * @throws \Magento\Framework\Model\Exception
  */
 public function deleteEntity(\Magento\Framework\Model\AbstractModel $object)
 {
     if (!$object->getEntityAttributeId()) {
         return $this;
     }
     $select = $this->_getReadAdapter()->select()->from($this->getTable('eav_entity_attribute'))->where('entity_attribute_id = ?', (int) $object->getEntityAttributeId());
     $result = $this->_getReadAdapter()->fetchRow($select);
     if ($result) {
         $attribute = $this->_eavConfig->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $result['attribute_id']);
         try {
             $this->attrLockValidator->validate($attribute, $result['attribute_set_id']);
         } catch (\Magento\Framework\Model\Exception $exception) {
             throw new \Magento\Framework\Model\Exception(__("Attribute '%1' is locked. ", $attribute->getAttributeCode()) . $exception->getMessage());
         }
         $backendTable = $attribute->getBackend()->getTable();
         if ($backendTable) {
             $select = $this->_getWriteAdapter()->select()->from($attribute->getEntity()->getEntityTable(), 'entity_id')->where('attribute_set_id = ?', $result['attribute_set_id']);
             $clearCondition = array('entity_type_id =?' => $attribute->getEntityTypeId(), 'attribute_id =?' => $attribute->getId(), 'entity_id IN (?)' => $select);
             $this->_getWriteAdapter()->delete($backendTable, $clearCondition);
         }
     }
     $condition = array('entity_attribute_id = ?' => $object->getEntityAttributeId());
     $this->_getWriteAdapter()->delete($this->getTable('eav_entity_attribute'), $condition);
     return $this;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:32,代码来源:Attribute.php

示例2: deleteEntity

 /**
  * Delete entity
  *
  * @param \Magento\Framework\Model\AbstractModel $object
  * @return $this
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function deleteEntity(\Magento\Framework\Model\AbstractModel $object)
 {
     if (!$object->getEntityAttributeId()) {
         return $this;
     }
     $result = $this->getEntityAttribute($object->getEntityAttributeId());
     if ($result) {
         $attribute = $this->_eavConfig->getAttribute($object->getEntityTypeId(), $result['attribute_id']);
         try {
             $this->attrLockValidator->validate($attribute, $result['attribute_set_id']);
         } catch (\Magento\Framework\Exception\LocalizedException $exception) {
             throw new \Magento\Framework\Exception\LocalizedException(__('Attribute \'%1\' is locked. %2', $attribute->getAttributeCode(), $exception->getMessage()));
         }
         $backendTable = $attribute->getBackend()->getTable();
         if ($backendTable) {
             $linkField = $this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField();
             $select = $this->getConnection()->select()->from($attribute->getEntity()->getEntityTable(), $linkField)->where('attribute_set_id = ?', $result['attribute_set_id']);
             $clearCondition = ['attribute_id =?' => $attribute->getId(), $linkField . ' IN (?)' => $select];
             $this->getConnection()->delete($backendTable, $clearCondition);
         }
     }
     $condition = ['entity_attribute_id = ?' => $object->getEntityAttributeId()];
     $this->getConnection()->delete($this->getTable('eav_entity_attribute'), $condition);
     return $this;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:32,代码来源:Attribute.php

示例3: deleteEntity

 /**
  * Delete entity
  *
  * @param AbstractModel $object
  * @return $this
  */
 public function deleteEntity(AbstractModel $object)
 {
     if (!$object->getEntityAttributeId()) {
         return $this;
     }
     $this->getConnection()->delete($this->getTable('eav_entity_attribute'), ['entity_attribute_id = ?' => $object->getEntityAttributeId()]);
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:Attribute.php

示例4: deleteEntity

 /**
  * Delete entity
  *
  * @param AbstractModel $object
  * @return $this
  */
 public function deleteEntity(AbstractModel $object)
 {
     if (!$object->getEntityAttributeId()) {
         return $this;
     }
     $this->_getWriteAdapter()->delete($this->getTable('eav_entity_attribute'), array('entity_attribute_id = ?' => $object->getEntityAttributeId()));
     return $this;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:14,代码来源:Attribute.php


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