
Public Member Functions | |
| lockAttribute ($attributeCode) | |
| unlockAttribute ($attributeCode) | |
| unlockAttributes () | |
| getLockedAttributes () | |
| hasLockedAttributes () | |
| isLockedAttribute ($attributeCode) | |
| setData ($key, $value=null) | |
| unsetData ($key=null) | |
| getResourceCollection () | |
| loadByAttribute ($attribute, $value, $additionalAttributes='*') | |
| getStore () | |
| getWebsiteStoreIds () | |
| setAttributeDefaultValue ($attributeCode, $value) | |
| getAttributeDefaultValue ($attributeCode) | |
| isDeleteable () | |
| setIsDeleteable ($value) | |
| isReadonly () | |
| setIsReadonly ($value) | |
Public Attributes | |
| const | DEFAULT_STORE_ID = 0 |
Protected Member Functions | |
| _beforeSave () | |
Protected Attributes | |
| $_defaultValues = array() | |
| $_lockedAttributes = array() | |
| $_isDeleteable = true | |
| $_isReadonly = false | |
Definition at line 34 of file Abstract.php.
| _beforeSave | ( | ) | [protected] |
Before save unlock attributes
Reimplemented from Mage_Core_Model_Abstract.
Reimplemented in Mage_Catalog_Model_Product.
Definition at line 272 of file Abstract.php.
00273 { 00274 $this->unlockAttributes(); 00275 return parent::_beforeSave(); 00276 }
| getAttributeDefaultValue | ( | $ | attributeCode | ) |
Retrieve default value for attribute code
| string | $attributeCode |
Definition at line 262 of file Abstract.php.
00263 { 00264 return isset($this->_defaultValues[$attributeCode]) ? $this->_defaultValues[$attributeCode] : null; 00265 }
| getLockedAttributes | ( | ) |
| getResourceCollection | ( | ) |
Get collection instance
Reimplemented from Mage_Core_Model_Abstract.
Reimplemented in Mage_Catalog_Model_Product.
Definition at line 202 of file Abstract.php.
00203 { 00204 $collection = parent::getResourceCollection() 00205 ->setStoreId($this->getStoreId()); 00206 return $collection; 00207 }
| getStore | ( | ) |
Retrieve sore object
Definition at line 227 of file Abstract.php.
00228 { 00229 return Mage::app()->getStore($this->getStoreId()); 00230 }
| getWebsiteStoreIds | ( | ) |
Retrieve all store ids of object current website
Definition at line 237 of file Abstract.php.
00238 { 00239 return $this->getStore()->getWebsite()->getStoreIds(true); 00240 }
| hasLockedAttributes | ( | ) |
Checks that model have locked attribtues
Definition at line 127 of file Abstract.php.
| isDeleteable | ( | ) |
| isLockedAttribute | ( | $ | attributeCode | ) |
| isReadonly | ( | ) |
| loadByAttribute | ( | $ | attribute, | |
| $ | value, | |||
| $ | additionalAttributes = '*' | |||
| ) |
Definition at line 209 of file Abstract.php.
00210 { 00211 $collection = $this->getResourceCollection() 00212 ->addAttributeToSelect($additionalAttributes) 00213 ->addAttributeToFilter($attribute, $value) 00214 ->setPage(1,1); 00215 00216 foreach ($collection as $object) { 00217 return $object; 00218 } 00219 return false; 00220 }
| lockAttribute | ( | $ | attributeCode | ) |
Lock attribute
| string | $attributeCode |
Definition at line 80 of file Abstract.php.
| setAttributeDefaultValue | ( | $ | attributeCode, | |
| $ | value | |||
| ) |
Adding attribute code and value to default value registry
Default value existing is flag for using store value in data
| string | $attributeCode |
Definition at line 250 of file Abstract.php.
| setData | ( | $ | key, | |
| $ | value = null | |||
| ) |
Overwrite data in the object.
$key can be string or array. If $key is string, the attribute value will be overwritten by $value
If $key is an array, it will overwrite all the data in the object.
$isChanged will specify if the object needs to be saved after an update.
| string|array | $key | |
| mixed | $value | |
| boolean | $isChanged |
Reimplemented from Varien_Object.
Definition at line 157 of file Abstract.php.
00158 { 00159 if ($this->hasLockedAttributes()) { 00160 if (is_array($key)) { 00161 foreach ($this->getLockedAttributes() as $attribute) { 00162 if (isset($key[$attribute])) { 00163 unset($key[$attribute]); 00164 } 00165 } 00166 } elseif ($this->isLockedAttribute($key)) { 00167 return $this; 00168 } 00169 } elseif ($this->isReadonly()) { 00170 return $this; 00171 } 00172 00173 return parent::setData($key, $value); 00174 }
| setIsDeleteable | ( | $ | value | ) |
Set is deleteable flag
| boolean | $value |
Definition at line 294 of file Abstract.php.
| setIsReadonly | ( | $ | value | ) |
Set is deleteable flag
| boolean | $value |
Definition at line 316 of file Abstract.php.
| unlockAttribute | ( | $ | attributeCode | ) |
Unlock attribute
| string | $attributeCode |
Definition at line 92 of file Abstract.php.
00093 { 00094 if ($this->isLockedAttribute($attributeCode)) { 00095 unset($this->_lockedAttributes[$attributeCode]); 00096 } 00097 00098 return $this; 00099 }
| unlockAttributes | ( | ) |
Unlock all attributes
Definition at line 106 of file Abstract.php.
00107 { 00108 $this->_lockedAttributes = array(); 00109 return $this; 00110 }
| unsetData | ( | $ | key = null |
) |
Unset data from the object.
$key can be a string only. Array will be ignored.
$isChanged will specify if the object needs to be saved after an update.
| string | $key | |
| boolean | $isChanged |
Reimplemented from Varien_Object.
Definition at line 187 of file Abstract.php.
00188 { 00189 if ((!is_null($key) && $this->isLockedAttribute($key)) || 00190 $this->isReadonly()) { 00191 return $this; 00192 } 00193 00194 return parent::unsetData($key); 00195 }
$_defaultValues = array() [protected] |
Definition at line 50 of file Abstract.php.
$_isDeleteable = true [protected] |
Definition at line 64 of file Abstract.php.
$_isReadonly = false [protected] |
Definition at line 71 of file Abstract.php.
$_lockedAttributes = array() [protected] |
Definition at line 57 of file Abstract.php.
| const DEFAULT_STORE_ID = 0 |
Identifuer of default store used for loading default data for entity
Definition at line 40 of file Abstract.php.
1.5.8