Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Flat Class Reference

Inheritance diagram for Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Flat:

Mage_Core_Model_Mysql4_Abstract Mage_Core_Model_Resource_Abstract

List of all members.

Public Member Functions

 setStoreId ($store)
 getFlatTableName ($store=null)
 getTypeId ()
 getAttributeForSelect ($attributeCode)
 getAttributeSortColumn ($attributeCode)
 getAllTableColumns ()
 isAttributeStatic ($attribute)
 getEntityIdField ()
 getAttribute ($attribute)

Protected Member Functions

 _construct ()

Protected Attributes

 $_storeId


Detailed Description

Definition at line 35 of file Flat.php.


Member Function Documentation

_construct (  )  [protected]

Init connection and resource table

Reimplemented from Mage_Core_Model_Resource_Abstract.

Definition at line 49 of file Flat.php.

00050     {
00051         $this->_init('catalog/product_flat', 'entity_id');
00052         $this->_storeId = Mage::app()->getStore()->getId();
00053     }

getAllTableColumns (  ) 

Retrieve Flat Table columns list

Returns:
array

Definition at line 137 of file Flat.php.

00138     {
00139         $describe = $this->_getWriteAdapter()->describeTable($this->getFlatTableName());
00140         return array_keys($describe);
00141     }

getAttribute ( attribute  ) 

Retrieve attribute instance Special for non static flat table

Parameters:
mixed $attribute
Returns:
Mage_Eav_Model_Entity_Attribute_Abstract

Definition at line 191 of file Flat.php.

00192     {
00193         return Mage::getSingleton('catalog/config')
00194             ->getAttribute('catalog_product', $attribute);
00195     }

getAttributeForSelect ( attributeCode  ) 

Retrieve attribute columns for collection select

Parameters:
string $attributeCode
Returns:
array|null

Definition at line 99 of file Flat.php.

00100     {
00101         $describe = $this->_getWriteAdapter()->describeTable($this->getFlatTableName());
00102         if (!isset($describe[$attributeCode])) {
00103             return null;
00104         }
00105         $columns = array($attributeCode => $attributeCode);
00106 
00107         if (isset($describe[$attributeCode . '_value'])) {
00108             $columns[$attributeCode . '_value'] = $attributeCode . '_value';
00109         }
00110 
00111         return $columns;
00112     }

getAttributeSortColumn ( attributeCode  ) 

Retrieve Attribute Sort column name

Parameters:
string $attributeCode
Returns:
string

Definition at line 120 of file Flat.php.

00121     {
00122         $describe = $this->_getWriteAdapter()->describeTable($this->getFlatTableName());
00123         if (!isset($describe[$attributeCode])) {
00124             return null;
00125         }
00126         if (isset($describe[$attributeCode . '_value'])) {
00127             return $attributeCode . '_value';
00128         }
00129         return $attributeCode;
00130     }

getEntityIdField (  ) 

Retrieve entity id field name in entity table Rewrited for EAV collection compatible

Returns:
string

Definition at line 179 of file Flat.php.

00180     {
00181         return $this->getIdFieldName();
00182     }

getFlatTableName ( store = null  ) 

Retrieve Flat Table name

Parameters:
mixed $store
Returns:
string

Definition at line 73 of file Flat.php.

00074     {
00075         if (!is_numeric($store)) {
00076             $store = Mage::app()->getStore($store)->getId();
00077         }
00078         return $this->getTable('catalog/product_flat') . '_' . $store;
00079     }

getTypeId (  ) 

Retrieve entity type id

Returns:
int

Definition at line 86 of file Flat.php.

00087     {
00088         return Mage::getSingleton('catalog/config')
00089             ->getEntityType('catalog_product')
00090             ->getEntityTypeId();
00091     }

isAttributeStatic ( attribute  ) 

Check whether the attribute is a real field in entity table Rewrited for EAV Collection

Parameters:
integer|string|Mage_Eav_Model_Entity_Attribute_Abstract $attribute
Returns:
bool

Definition at line 150 of file Flat.php.

00151     {
00152         $attributeCode = null;
00153         if ($attribute instanceof Mage_Eav_Model_Entity_Attribute_Interface) {
00154             $attributeCode = $attribute->getAttributeCode();
00155         }
00156         elseif (is_string($attribute)) {
00157             $attributeCode = $attribute;
00158         }
00159         elseif (is_numeric($attribute)) {
00160             $attributeCode = $this->getAttribute($attribute)
00161                 ->getAttributeCode();
00162         }
00163 
00164         if ($attributeCode) {
00165             $columns = $this->getAllTableColumns();
00166             if (in_array($attributeCode, $columns)) {
00167                 return true;
00168             }
00169         }
00170 
00171         return false;
00172     }

setStoreId ( store  ) 

Set store scope for resource model

Parameters:
mixed $store
Returns:
Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Flat

Definition at line 61 of file Flat.php.

00062     {
00063         $this->_storeId = Mage::app()->getStore($store)->getId();
00064         return $this;
00065     }


Member Data Documentation

$_storeId [protected]

Definition at line 43 of file Flat.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:44 2009 for Magento by  doxygen 1.5.8