Public Member Functions | |
fetchEntityTypeData ($entityType) | |
Protected Member Functions | |
_construct () | |
_loadTypes () | |
_loadTypeAttributes ($typeId) | |
Static Protected Attributes | |
static | $_entityTypes |
static | $_attributes = array() |
Definition at line 28 of file Config.php.
_construct | ( | ) | [protected] |
Resource initialization
Reimplemented from Mage_Core_Model_Resource_Abstract.
Definition at line 33 of file Config.php.
00034 { 00035 $this->_init('eav/entity_type', 'entity_type_id'); 00036 }
_loadTypeAttributes | ( | $ | typeId | ) | [protected] |
Definition at line 62 of file Config.php.
00063 { 00064 if (!isset(self::$_attributes[$typeId])) { 00065 $select = $this->_getReadAdapter()->select()->from($this->getTable('eav/attribute')) 00066 ->where('entity_type_id=?', $typeId); 00067 self::$_attributes[$typeId] = $this->_getReadAdapter()->fetchAll($select); 00068 } 00069 return self::$_attributes[$typeId]; 00070 }
_loadTypes | ( | ) | [protected] |
Load all entity types
Definition at line 43 of file Config.php.
00044 { 00045 if (!$this->_getReadAdapter()) { 00046 self::$_entityTypes = array(); 00047 return $this; 00048 } 00049 if (is_null(self::$_entityTypes)) { 00050 self::$_entityTypes = array(); 00051 $select = $this->_getReadAdapter()->select()->from($this->getMainTable()); 00052 $data = $this->_getReadAdapter()->fetchAll($select); 00053 foreach ($data as $row) { 00054 self::$_entityTypes['by_id'][$row['entity_type_id']] = $row; 00055 self::$_entityTypes['by_code'][$row['entity_type_code']] = $row; 00056 } 00057 } 00058 00059 return $this; 00060 }
fetchEntityTypeData | ( | $ | entityType | ) |
Definition at line 72 of file Config.php.
00073 { 00074 $this->_loadTypes(); 00075 00076 if (is_numeric($entityType)) { 00077 $info = isset(self::$_entityTypes['by_id'][$entityType]) ? self::$_entityTypes['by_id'][$entityType] : null; 00078 } 00079 else { 00080 $info = isset(self::$_entityTypes['by_code'][$entityType]) ? self::$_entityTypes['by_code'][$entityType] : null; 00081 } 00082 00083 $data = array(); 00084 if ($info) { 00085 $data['entity'] = $info; 00086 $attributes = $this->_loadTypeAttributes($info['entity_type_id']); 00087 $data['attributes'] = array(); 00088 foreach ($attributes as $attribute) { 00089 $data['attributes'][$attribute['attribute_id']] = $attribute; 00090 $data['attributes'][$attribute['attribute_code']] = $attribute['attribute_id']; 00091 } 00092 } 00093 return $data; 00094 }
$_attributes = array() [static, protected] |
Definition at line 31 of file Config.php.
$_entityTypes [static, protected] |
Definition at line 30 of file Config.php.