Public Member Functions | |
setAttribute ($attribute) | |
getAttribute () | |
getType () | |
isStatic () | |
getTable () | |
getEntityIdField () | |
setValueId ($valueId) | |
getValueId () | |
getDefaultValue () | |
validate ($object) | |
afterLoad ($object) | |
beforeSave ($object) | |
afterSave ($object) | |
beforeDelete ($object) | |
afterDelete ($object) | |
Protected Attributes | |
$_attribute | |
$_valueId | |
$_table | |
$_entityIdField | |
$_defaultValue = null |
Definition at line 35 of file Abstract.php.
afterDelete | ( | $ | object | ) |
Implements Mage_Eav_Model_Entity_Attribute_Backend_Interface.
Reimplemented in Mage_Catalog_Model_Product_Attribute_Backend_Tierprice, and Mage_Weee_Model_Attribute_Backend_Weee_Tax.
Definition at line 219 of file Abstract.php.
afterLoad | ( | $ | object | ) |
Implements Mage_Eav_Model_Entity_Attribute_Backend_Interface.
Reimplemented in Mage_Catalog_Model_Category_Attribute_Backend_Sortby, Mage_Catalog_Model_Product_Attribute_Backend_Media, Mage_Catalog_Model_Product_Attribute_Backend_Tierprice, Mage_GiftMessage_Model_Entity_Attribute_Backend_Boolean_Config, and Mage_Weee_Model_Attribute_Backend_Weee_Tax.
Definition at line 196 of file Abstract.php.
afterSave | ( | $ | object | ) |
Implements Mage_Eav_Model_Entity_Attribute_Backend_Interface.
Reimplemented in Mage_Catalog_Model_Category_Attribute_Backend_Urlkey, Mage_Catalog_Model_Product_Attribute_Backend_Media, Mage_Catalog_Model_Product_Attribute_Backend_Price, Mage_Catalog_Model_Product_Attribute_Backend_Tierprice, Mage_Catalog_Model_Product_Attribute_Backend_Urlkey, Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Backend_Image, Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Backend_Urlkey, Mage_Customer_Model_Customer_Attribute_Backend_Billing, Mage_Customer_Model_Customer_Attribute_Backend_Shipping, Mage_Sales_Model_Entity_Order_Attribute_Backend_Billing, Mage_Sales_Model_Entity_Order_Attribute_Backend_Parent, Mage_Sales_Model_Entity_Order_Attribute_Backend_Shipping, Mage_Sales_Model_Entity_Order_Creditmemo_Attribute_Backend_Parent, Mage_Sales_Model_Entity_Order_Invoice_Attribute_Backend_Item, Mage_Sales_Model_Entity_Order_Invoice_Attribute_Backend_Parent, Mage_Sales_Model_Entity_Order_Shipment_Attribute_Backend_Parent, Mage_Sales_Model_Entity_Quote_Address_Attribute_Backend_Parent, Mage_Sales_Model_Mysql4_Order_Attribute_Backend_Billing, Mage_Sales_Model_Mysql4_Order_Attribute_Backend_Parent, Mage_Sales_Model_Mysql4_Order_Attribute_Backend_Shipping, Mage_Sales_Model_Mysql4_Order_Creditmemo_Attribute_Backend_Parent, Mage_Sales_Model_Mysql4_Order_Invoice_Attribute_Backend_Item, Mage_Sales_Model_Mysql4_Order_Invoice_Attribute_Backend_Parent, Mage_Sales_Model_Mysql4_Order_Shipment_Attribute_Backend_Parent, Mage_Sales_Model_Mysql4_Quote_Address_Attribute_Backend_Parent, and Mage_Weee_Model_Attribute_Backend_Weee_Tax.
Definition at line 209 of file Abstract.php.
beforeDelete | ( | $ | object | ) |
Implements Mage_Eav_Model_Entity_Attribute_Backend_Interface.
Definition at line 214 of file Abstract.php.
beforeSave | ( | $ | object | ) |
Implements Mage_Eav_Model_Entity_Attribute_Backend_Interface.
Reimplemented in Mage_Catalog_Model_Category_Attribute_Backend_Image, Mage_Catalog_Model_Category_Attribute_Backend_Sortby, Mage_Catalog_Model_Category_Attribute_Backend_Urlkey, Mage_Catalog_Model_Product_Attribute_Backend_Media, Mage_Catalog_Model_Product_Attribute_Backend_Startdate, Mage_Catalog_Model_Product_Attribute_Backend_Urlkey, Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Backend_Urlkey, Mage_Customer_Model_Customer_Attribute_Backend_Billing, Mage_Customer_Model_Customer_Attribute_Backend_Password, Mage_Customer_Model_Customer_Attribute_Backend_Shipping, Mage_Customer_Model_Customer_Attribute_Backend_Store, Mage_Customer_Model_Customer_Attribute_Backend_Website, Mage_Customer_Model_Entity_Address_Attribute_Backend_Region, Mage_Customer_Model_Entity_Address_Attribute_Backend_Street, Mage_Eav_Model_Entity_Attribute_Backend_Array, Mage_Eav_Model_Entity_Attribute_Backend_Datetime, Mage_Eav_Model_Entity_Attribute_Backend_Increment, Mage_Eav_Model_Entity_Attribute_Backend_Time_Created, Mage_Eav_Model_Entity_Attribute_Backend_Time_Updated, Mage_GiftMessage_Model_Entity_Attribute_Backend_Boolean_Config, Mage_Sales_Model_Entity_Order_Attribute_Backend_Billing, Mage_Sales_Model_Entity_Order_Attribute_Backend_Child, Mage_Sales_Model_Entity_Order_Attribute_Backend_Shipping, Mage_Sales_Model_Entity_Order_Creditmemo_Attribute_Backend_Child, Mage_Sales_Model_Entity_Order_Invoice_Attribute_Backend_Child, Mage_Sales_Model_Entity_Order_Invoice_Attribute_Backend_Order, Mage_Sales_Model_Entity_Order_Shipment_Attribute_Backend_Child, Mage_Sales_Model_Entity_Quote_Address_Attribute_Backend_Child, Mage_Sales_Model_Entity_Quote_Address_Attribute_Backend_Region, Mage_Sales_Model_Mysql4_Order_Attribute_Backend_Billing, Mage_Sales_Model_Mysql4_Order_Attribute_Backend_Child, Mage_Sales_Model_Mysql4_Order_Attribute_Backend_Shipping, Mage_Sales_Model_Mysql4_Order_Creditmemo_Attribute_Backend_Child, Mage_Sales_Model_Mysql4_Order_Invoice_Attribute_Backend_Child, Mage_Sales_Model_Mysql4_Order_Invoice_Attribute_Backend_Order, Mage_Sales_Model_Mysql4_Order_Shipment_Attribute_Backend_Child, Mage_Sales_Model_Mysql4_Quote_Address_Attribute_Backend_Child, and Mage_Sales_Model_Mysql4_Quote_Address_Attribute_Backend_Region.
Definition at line 201 of file Abstract.php.
00202 { 00203 $attrCode = $this->getAttribute()->getAttributeCode(); 00204 if (!$object->hasData($attrCode) && $this->getDefaultValue()) { 00205 $object->setData($attrCode, $this->getDefaultValue()); 00206 } 00207 }
getAttribute | ( | ) |
getDefaultValue | ( | ) |
Definition at line 164 of file Abstract.php.
00165 { 00166 if (is_null($this->_defaultValue)) { 00167 if ($this->getAttribute()->getDefaultValue()) { 00168 $this->_defaultValue = $this->getAttribute()->getDefaultValue(); 00169 } else { 00170 $this->_defaultValue = ""; 00171 } 00172 } 00173 return $this->_defaultValue; 00174 }
getEntityIdField | ( | ) |
Get entity_id field in the attribute values tables
Implements Mage_Eav_Model_Entity_Attribute_Backend_Interface.
Definition at line 141 of file Abstract.php.
00142 { 00143 if (empty($this->_entityIdField)) { 00144 if ($this->getAttribute()->getEntityIdField()) { 00145 $this->_entityIdField = $this->getAttribute()->getEntityIdField(); 00146 } else { 00147 $this->_entityIdField = $this->getAttribute()->getEntityType()->getValueEntityIdField(); 00148 } 00149 } 00150 return $this->_entityIdField; 00151 }
getTable | ( | ) |
Get table name for the values of the attribute
Implements Mage_Eav_Model_Entity_Attribute_Backend_Interface.
Reimplemented in Mage_Weee_Model_Attribute_Backend_Weee_Tax.
Definition at line 119 of file Abstract.php.
00120 { 00121 if (empty($this->_table)) { 00122 if ($this->isStatic()) { 00123 $this->_table = $this->getAttribute()->getEntityType()->getValueTablePrefix(); 00124 } elseif ($this->getAttribute()->getBackendTable()) { 00125 $this->_table = $this->getAttribute()->getBackendTable(); 00126 } else { 00127 $entity = $this->getAttribute()->getEntity(); 00128 $this->_table = $entity->getValueTablePrefix() 00129 .'_'.$this->getType(); 00130 } 00131 } 00132 00133 return $this->_table; 00134 }
getType | ( | ) |
Get backend type of the attribute
Implements Mage_Eav_Model_Entity_Attribute_Backend_Interface.
Definition at line 99 of file Abstract.php.
00100 { 00101 return $this->getAttribute()->getBackendType(); 00102 }
getValueId | ( | ) |
Implements Mage_Eav_Model_Entity_Attribute_Backend_Interface.
Definition at line 159 of file Abstract.php.
isStatic | ( | ) |
Check whether the attribute is a real field in the entity table
Implements Mage_Eav_Model_Entity_Attribute_Backend_Interface.
Definition at line 109 of file Abstract.php.
00110 { 00111 return $this->getAttribute()->isStatic(); 00112 }
setAttribute | ( | $ | attribute | ) |
Set attribute instance
Mage_Eav_Model_Entity_Attribute_Abstract | $attribute |
Reimplemented in Mage_Catalog_Model_Product_Attribute_Backend_Price.
Definition at line 78 of file Abstract.php.
00079 { 00080 $this->_attribute = $attribute; 00081 return $this; 00082 }
setValueId | ( | $ | valueId | ) |
Implements Mage_Eav_Model_Entity_Attribute_Backend_Interface.
Definition at line 153 of file Abstract.php.
00154 { 00155 $this->_valueId = $valueId; 00156 return $this; 00157 }
validate | ( | $ | object | ) |
Reimplemented in Mage_Catalog_Model_Category_Attribute_Backend_Sortby, Mage_Catalog_Model_Product_Attribute_Backend_Tierprice, Mage_Customer_Model_Customer_Attribute_Backend_Password, and Mage_Weee_Model_Attribute_Backend_Weee_Tax.
Definition at line 176 of file Abstract.php.
00177 { 00178 $attrCode = $this->getAttribute()->getAttributeCode(); 00179 if ($this->getAttribute()->getIsRequired() && !$object->getData($attrCode)) { 00180 return false; 00181 } 00182 $value = $object->getData($this->getAttribute()->getAttributeCode()); 00183 if ($this->getAttribute()->getIsUnique() && !$this->getAttribute()->getIsRequired() && ($value == '' || $this->getAttribute()->isValueEmpty($value))) { 00184 return true; 00185 } 00186 00187 if ($this->getAttribute()->getIsUnique()) { 00188 if (!$this->getAttribute()->getEntity()->checkAttributeUniqueValue($this->getAttribute(), $object)) { 00189 $label = $this->getAttribute()->getFrontend()->getLabel(); 00190 Mage::throwException(Mage::helper('eav')->__('Value of attribute "%s" must be unique', $label)); 00191 } 00192 } 00193 return true; 00194 }
$_attribute [protected] |
Definition at line 42 of file Abstract.php.
$_defaultValue = null [protected] |
Definition at line 70 of file Abstract.php.
$_entityIdField [protected] |
Definition at line 63 of file Abstract.php.
$_table [protected] |
Definition at line 56 of file Abstract.php.
$_valueId [protected] |
Definition at line 49 of file Abstract.php.