Public Member Functions | |
loadByCode ($code) | |
getAttributeCollection ($setId=null) | |
getAttributeSetCollection () | |
fetchNewIncrementId ($storeId=null) | |
getEntityIdField () | |
getEntityTable () | |
getValueTablePrefix () | |
getDefaultAttributeSetId () | |
getEntityTypeId () | |
getEntityTypeCode () | |
getAttributeCodes () | |
getAttributeModel () | |
getEntity () | |
Protected Member Functions | |
_construct () | |
_getAttributeCollection () | |
Protected Attributes | |
$_attributes | |
$_attributesBySet = array() | |
$_sets |
Definition at line 35 of file Type.php.
_construct | ( | ) | [protected] |
Enter description here...
Reimplemented from Varien_Object.
Definition at line 63 of file Type.php.
00064 { 00065 $this->_init('eav/entity_type'); 00066 }
_getAttributeCollection | ( | ) | [protected] |
Enter description here...
Definition at line 112 of file Type.php.
00113 { 00114 $collection = Mage::getModel('eav/entity_attribute')->getCollection(); 00115 if ($objectsModel = $this->getAttributeModel()) { 00116 $collection->setModel($objectsModel); 00117 } 00118 return $collection; 00119 }
fetchNewIncrementId | ( | $ | storeId = null |
) |
Enter description here...
int | $storeId |
store_id null we can have for entity from removed store
do read lock on eav/entity_store to solve potential timing issues (most probably already done by beginTransaction of entity save)
Definition at line 141 of file Type.php.
00142 { 00143 if (!$this->getIncrementModel()) { 00144 return false; 00145 } 00146 00147 if (!$this->getIncrementPerStore()) { 00148 $storeId = 0; 00149 } 00150 elseif (is_null($storeId)) { 00151 /** 00152 * store_id null we can have for entity from removed store 00153 */ 00154 $storeId = 0; 00155 //throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Valid store_id is expected!')); 00156 } 00157 00158 $entityStoreConfig = Mage::getModel('eav/entity_store') 00159 ->loadByEntityStore($this->getId(), $storeId); 00160 00161 if (!$entityStoreConfig->getId()) { 00162 $entityStoreConfig 00163 ->setEntityTypeId($this->getId()) 00164 ->setStoreId($storeId) 00165 ->setIncrementPrefix($storeId) 00166 ->save(); 00167 } 00168 00169 $incrementInstance = Mage::getModel($this->getIncrementModel()) 00170 ->setPrefix($entityStoreConfig->getIncrementPrefix()) 00171 ->setPadLength($this->getIncrementPadLength()) 00172 ->setPadChar($this->getIncrementPadChar()) 00173 ->setLastId($entityStoreConfig->getIncrementLastId()) 00174 ->setEntityTypeId($entityStoreConfig->getEntityTypeId()) 00175 ->setStoreId($entityStoreConfig->getStoreId()); 00176 00177 /** 00178 * do read lock on eav/entity_store to solve potential timing issues 00179 * (most probably already done by beginTransaction of entity save) 00180 */ 00181 $incrementId = $incrementInstance->getNextId(); 00182 $entityStoreConfig->setIncrementLastId($incrementId); 00183 $entityStoreConfig->save(); 00184 00185 return $incrementId; 00186 }
getAttributeCodes | ( | ) |
getAttributeCollection | ( | $ | setId = null |
) |
Retrieve entity type attributes collection
int | $setId |
Definition at line 87 of file Type.php.
00088 { 00089 if (is_null($setId)) { 00090 if (is_null($this->_attributes)) { 00091 $this->_attributes = $this->_getAttributeCollection() 00092 ->setEntityTypeFilter($this->getId()); 00093 } 00094 $collection = $this->_attributes; 00095 } 00096 else { 00097 if (!isset($this->_attributesBySet[$setId])) { 00098 $this->_attributesBySet[$setId] = $this->_getAttributeCollection() 00099 ->setEntityTypeFilter($this->getId()) 00100 ->setAttributeSetFilter($setId); 00101 } 00102 $collection = $this->_attributesBySet[$setId]; 00103 } 00104 return $collection; 00105 }
getAttributeModel | ( | ) |
Get attribute model code for entity type
Definition at line 256 of file Type.php.
00257 { 00258 if (empty($this->_data['attribute_model'])) { 00259 return Mage_Eav_Model_Entity::DEFAULT_ATTRIBUTE_MODEL; 00260 } 00261 else { 00262 return $this->_data['attribute_model']; 00263 } 00264 }
getAttributeSetCollection | ( | ) |
Retrieve entity tpe sets collection
Definition at line 126 of file Type.php.
00127 { 00128 if (empty($this->_sets)) { 00129 $this->_sets = Mage::getModel('eav/entity_attribute_set')->getResourceCollection() 00130 ->setEntityTypeFilter($this->getId()); 00131 } 00132 return $this->_sets; 00133 }
getDefaultAttributeSetId | ( | ) |
getEntity | ( | ) |
Definition at line 266 of file Type.php.
00267 { 00268 return Mage::getResourceSingleton($this->_data['entity_model']); 00269 }
getEntityIdField | ( | ) |
getEntityTable | ( | ) |
getEntityTypeCode | ( | ) |
getEntityTypeId | ( | ) |
getValueTablePrefix | ( | ) |
Enter description here...
Definition at line 213 of file Type.php.
00214 { 00215 if (empty($this->_data['value_table_prefix'])) { 00216 $this->_data['value_table_prefix'] = $this->_getResource()->getTable($this->getEntityTable()); 00217 } 00218 return $this->_data['value_table_prefix']; 00219 }
loadByCode | ( | $ | code | ) |
Enter description here...
string | $code |
Definition at line 74 of file Type.php.
00075 { 00076 $this->_getResource()->loadByCode($this, $code); 00077 $this->_afterLoad(); 00078 return $this; 00079 }