本文整理汇总了PHP中Mage_Core_Model_Abstract::getEntityAttributeId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Abstract::getEntityAttributeId方法的具体用法?PHP Mage_Core_Model_Abstract::getEntityAttributeId怎么用?PHP Mage_Core_Model_Abstract::getEntityAttributeId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Model_Abstract::getEntityAttributeId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteEntity
/**
* Delete entity
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Catalog_Model_Resource_Attribute
*/
public function deleteEntity(Mage_Core_Model_Abstract $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 = Mage::getSingleton('eav/config')->getAttribute(Mage_Catalog_Model_Product::ENTITY, $result['attribute_id']);
if (!$attribute->getData('is_user_defined')) {
Mage::throwException(Mage::helper('eav')->__("Attribute '%s' is a system attribute and must be included in all attribute sets.", $attribute->getAttributeCode()));
}
if ($this->isUsedBySuperProducts($attribute, $result['attribute_set_id'])) {
Mage::throwException(Mage::helper('eav')->__("Attribute '%s' used in configurable products and can not be removed from '%s' attribute set", $attribute->getAttributeCode(), $object->getAttributeSetName()));
}
}
$condition = array('entity_attribute_id = ?' => $object->getEntityAttributeId());
$this->_getWriteAdapter()->delete($this->getTable('entity_attribute'), $condition);
return $this;
}
示例2: deleteEntity
/**
* Enter description here...
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Eav_Model_Mysql4_Entity_Attribute
*/
public function deleteEntity(Mage_Core_Model_Abstract $object)
{
$write = $this->_getWriteAdapter();
$condition = $write->quoteInto($this->getTable('entity_attribute') . '.entity_attribute_id = ?', $object->getEntityAttributeId());
/**
* Delete attribute values
*/
$select = $write->select()->from($this->getTable('entity_attribute'))->where($condition);
$data = $write->fetchRow($select);
if (!empty($data)) {
/**
* @todo !!!! need fix retrieving attribute entity, this realization is temprary
*/
$attribute = Mage::getModel('eav/entity_attribute')->load($data['attribute_id'])->setEntity(Mage::getSingleton('catalog/product')->getResource());
if ($backendTable = $attribute->getBackend()->getTable()) {
$clearCondition = array($write->quoteInto('entity_type_id=?', $attribute->getEntityTypeId()), $write->quoteInto('attribute_id=?', $attribute->getId()), $write->quoteInto('entity_id IN (
SELECT entity_id FROM ' . $attribute->getEntity()->getEntityTable() . ' WHERE attribute_set_id=?)', $data['attribute_set_id']));
$write->delete($backendTable, $clearCondition);
}
}
$write->delete($this->getTable('entity_attribute'), $condition);
return $this;
}
示例3: deleteEntity
/**
* Delete entity
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Catalog_Model_Resource_Attribute
*/
public function deleteEntity(Mage_Core_Model_Abstract $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 = Mage::getSingleton('eav/config')->getAttribute(Mage_Catalog_Model_Product::ENTITY, $result['attribute_id']);
if ($this->isUsedBySuperProducts($attribute, $result['attribute_set_id'])) {
Mage::throwException(Mage::helper('eav')->__("Attribute '%s' used in configurable products", $attribute->getAttributeCode()));
}
$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('entity_attribute'), $condition);
return $this;
}
示例4: deleteEntity
/**
* Delete entity
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Eav_Model_Resource_Entity_Attribute
*/
public function deleteEntity(Mage_Core_Model_Abstract $object)
{
if (!$object->getEntityAttributeId()) {
return $this;
}
$this->_getWriteAdapter()->delete($this->getTable('eav_entity_attribute'), array('entity_attribute_id = ?' => $object->getEntityAttributeId()));
return $this;
}