Public Member Functions | |
__construct ($resource=null) | |
getTable ($table) | |
setEntity ($entity) | |
getEntity () | |
getResource () | |
setObject ($object=null) | |
addItem (Varien_Object $object) | |
getAttribute ($attributeCode) | |
addAttributeToFilter ($attribute, $condition=null, $joinType='inner') | |
addFieldToFilter ($attribute, $condition=null) | |
addAttributeToSort ($attribute, $dir='asc') | |
addAttributeToSelect ($attribute, $joinType=false) | |
addEntityTypeToSelect ($entityType, $prefix) | |
addStaticField ($field) | |
addExpressionAttributeToSelect ($alias, $expression, $attribute) | |
groupByAttribute ($attribute) | |
joinAttribute ($alias, $attribute, $bind, $filter=null, $joinType='inner', $storeId=null) | |
joinField ($alias, $table, $field, $bind, $cond=null, $joinType='inner') | |
joinTable ($table, $bind, $fields=null, $cond=null, $joinType='inner') | |
removeAttributeToSelect ($attribute=null) | |
setPage ($pageNum, $pageSize) | |
load ($printQuery=false, $logQuery=false) | |
getAllIds ($limit=null, $offset=null) | |
getAllIdsSql () | |
save () | |
delete () | |
importFromArray ($arr) | |
exportToArray () | |
getRowIdFieldName () | |
setRowIdFieldName ($fieldName) | |
_loadEntities ($printQuery=false, $logQuery=false) | |
_loadAttributes ($printQuery=false, $logQuery=false) | |
setOrder ($attribute, $dir='desc') | |
toArray ($arrAttributes=array()) | |
getLoadedIds () | |
Protected Member Functions | |
_construct () | |
_prepareStaticFields () | |
_initSelect () | |
_init ($model, $entityModel=null) | |
_getLoadAttributesSelect ($table, $attributeIds=array()) | |
_setItemAttributeValue ($valueInfo) | |
_getAttributeTableAlias ($attributeCode) | |
_getAttributeFieldName ($attributeCode) | |
_addAttributeJoin ($attributeCode, $joinType='inner') | |
_joinAttributeToSelect ($method, $attribute, $tableAlias, $condition, $fieldCode, $fieldAlias) | |
_getAttributeConditionSql ($attribute, $condition, $joinType='inner') | |
_beforeLoad () | |
_afterLoad () | |
_reset () | |
Protected Attributes | |
$_itemsById = array() | |
$_staticFields = array() | |
$_entity | |
$_selectEntityTypes = array() | |
$_selectAttributes = array() | |
$_filterAttributes = array() | |
$_joinEntities = array() | |
$_joinAttributes = array() | |
$_joinFields = array() |
Definition at line 35 of file Abstract.php.
__construct | ( | $ | resource = null |
) |
Collection constructor
Mage_Core_Model_Mysql4_Abstract | $resource |
Reimplemented from Varien_Data_Collection_Db.
Definition at line 105 of file Abstract.php.
00106 { 00107 parent::__construct(); 00108 $this->_construct(); 00109 $this->setConnection($this->getEntity()->getReadConnection()); 00110 $this->_prepareStaticFields(); 00111 $this->_initSelect(); 00112 }
_addAttributeJoin | ( | $ | attributeCode, | |
$ | joinType = 'inner' | |||
) | [protected] |
Add attribute value table to the join if it wasn't added previously
string | $attributeCode | |
string | $joinType inner|left |
process join type
Fix double join for using same as filter
Definition at line 1095 of file Abstract.php.
01096 { 01097 if (!empty($this->_filterAttributes[$attributeCode])) { 01098 return $this; 01099 } 01100 01101 $attrTable = $this->_getAttributeTableAlias($attributeCode); 01102 if (isset($this->_joinAttributes[$attributeCode])) { 01103 $attribute = $this->_joinAttributes[$attributeCode]['attribute']; 01104 $entity = $attribute->getEntity(); 01105 $entityIdField = $entity->getEntityIdField(); 01106 $fkName = $this->_joinAttributes[$attributeCode]['bind']; 01107 $fkAttribute = $this->_joinAttributes[$attributeCode]['bindAttribute']; 01108 $fkTable = $this->_getAttributeTableAlias($fkName); 01109 01110 if ($fkAttribute->getBackend()->isStatic()) { 01111 if (isset($this->_joinAttributes[$fkName])) { 01112 $fk = $fkTable.".".$fkAttribute->getAttributeCode(); 01113 } else { 01114 $fk = "e.".$fkAttribute->getAttributeCode(); 01115 } 01116 } else { 01117 $this->_addAttributeJoin($fkAttribute->getAttributeCode(), $joinType); 01118 $fk = "$fkTable.value"; 01119 } 01120 $pk = $attrTable.'.'.$this->_joinAttributes[$attributeCode]['filter']; 01121 } else { 01122 $entity = $this->getEntity(); 01123 $entityIdField = $entity->getEntityIdField(); 01124 $attribute = $entity->getAttribute($attributeCode); 01125 $fk = "e.$entityIdField"; 01126 $pk = "$attrTable.$entityIdField"; 01127 } 01128 01129 if (!$attribute) { 01130 throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid attribute name: %s', $attributeCode)); 01131 } 01132 01133 if ($attribute->getBackend()->isStatic()) { 01134 $attrFieldName = "$attrTable.".$attribute->getAttributeCode(); 01135 } else { 01136 $attrFieldName = "$attrTable.value"; 01137 } 01138 01139 $condArr = array("$pk = $fk"); 01140 if (!$attribute->getBackend()->isStatic()) { 01141 $condArr[] = $this->getConnection()->quoteInto("$attrTable.attribute_id=?", $attribute->getId()); 01142 } 01143 01144 /** 01145 * process join type 01146 */ 01147 $joinMethod = ($joinType == 'left') ? 'joinLeft' : 'join'; 01148 01149 $this->_joinAttributeToSelect($joinMethod, $attribute, $attrTable, $condArr, $attributeCode, $attrFieldName); 01150 01151 $this->removeAttributeToSelect($attributeCode); 01152 $this->_filterAttributes[$attributeCode] = $attribute->getId(); 01153 01154 /** 01155 * Fix double join for using same as filter 01156 */ 01157 $this->_joinFields[$attributeCode] = array( 01158 'table' => '', 01159 'field' => $attrFieldName, 01160 ); 01161 01162 return $this; 01163 }
_afterLoad | ( | ) | [protected] |
Reimplemented from Varien_Data_Collection_Db.
Reimplemented in Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection, Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection, Mage_Review_Model_Mysql4_Review_Product_Collection, Mage_Sales_Model_Entity_Quote_Item_Collection, and Mage_Tag_Model_Mysql4_Product_Collection.
Definition at line 1262 of file Abstract.php.
_beforeLoad | ( | ) | [protected] |
Reimplemented in Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection, Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection, and Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Link_Product_Collection.
Definition at line 1257 of file Abstract.php.
_construct | ( | ) | [protected] |
Initialize collection
Reimplemented in Mage_Bundle_Model_Mysql4_Selection_Collection, Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection, Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection, Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Compare_Item_Collection, Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Type_Configurable_Product_Collection, Mage_Customer_Model_Entity_Address_Collection, Mage_Customer_Model_Entity_Customer_Collection, Mage_Customer_Model_Entity_Wishlist_Collection, Mage_Reports_Model_Mysql4_Tax_Collection, Mage_Reports_Model_Mysql4_Wishlist_Product_Collection, Mage_Review_Model_Mysql4_Review_Product_Collection, Mage_Sales_Model_Entity_Order_Address_Collection, Mage_Sales_Model_Entity_Order_Collection, Mage_Sales_Model_Entity_Order_Creditmemo_Collection, Mage_Sales_Model_Entity_Order_Creditmemo_Comment_Collection, Mage_Sales_Model_Entity_Order_Creditmemo_Item_Collection, Mage_Sales_Model_Entity_Order_Invoice_Collection, Mage_Sales_Model_Entity_Order_Invoice_Comment_Collection, Mage_Sales_Model_Entity_Order_Invoice_Item_Collection, Mage_Sales_Model_Entity_Order_Item_Collection, Mage_Sales_Model_Entity_Order_Payment_Collection, Mage_Sales_Model_Entity_Order_Shipment_Collection, Mage_Sales_Model_Entity_Order_Shipment_Comment_Collection, Mage_Sales_Model_Entity_Order_Shipment_Item_Collection, Mage_Sales_Model_Entity_Order_Shipment_Track_Collection, Mage_Sales_Model_Entity_Order_Status_History_Collection, Mage_Sales_Model_Entity_Quote_Address_Collection, Mage_Sales_Model_Entity_Quote_Address_Item_Collection, Mage_Sales_Model_Entity_Quote_Address_Rate_Collection, Mage_Sales_Model_Entity_Quote_Collection, Mage_Sales_Model_Entity_Quote_Item_Collection, Mage_Sales_Model_Entity_Quote_Payment_Collection, Mage_Sales_Model_Mysql4_Order_Address_Collection, Mage_Sales_Model_Mysql4_Order_Collection, Mage_Sales_Model_Mysql4_Order_Creditmemo_Collection, Mage_Sales_Model_Mysql4_Order_Creditmemo_Comment_Collection, Mage_Sales_Model_Mysql4_Order_Creditmemo_Item_Collection, Mage_Sales_Model_Mysql4_Order_Invoice_Collection, Mage_Sales_Model_Mysql4_Order_Invoice_Comment_Collection, Mage_Sales_Model_Mysql4_Order_Invoice_Item_Collection, Mage_Sales_Model_Mysql4_Order_Payment_Collection, Mage_Sales_Model_Mysql4_Order_Shipment_Collection, Mage_Sales_Model_Mysql4_Order_Shipment_Comment_Collection, Mage_Sales_Model_Mysql4_Order_Shipment_Item_Collection, Mage_Sales_Model_Mysql4_Order_Shipment_Track_Collection, Mage_Sales_Model_Mysql4_Order_Status_History_Collection, and Mage_Wishlist_Model_Mysql4_Item_Collection.
Definition at line 117 of file Abstract.php.
_getAttributeConditionSql | ( | $ | attribute, | |
$ | condition, | |||
$ | joinType = 'inner' | |||
) | [protected] |
Get condition sql for the attribute
string | $attribute | |
mixed | $condition |
Definition at line 1194 of file Abstract.php.
01195 { 01196 if (isset($this->_joinFields[$attribute])) { 01197 return $this->_getConditionSql($this->_getAttributeFieldName($attribute), $condition); 01198 } 01199 if (isset($this->_staticFields[$attribute])) { 01200 return $this->_getConditionSql(sprintf('e.%s', $attribute), $condition); 01201 } 01202 // process linked attribute 01203 if (isset($this->_joinAttributes[$attribute])) { 01204 $entity = $this->getAttribute($attribute)->getEntity(); 01205 $entityTable = $entity->getEntityTable(); 01206 } else { 01207 $entity = $this->getEntity(); 01208 $entityTable = 'e'; 01209 } 01210 01211 if ($entity->isAttributeStatic($attribute)) { 01212 $conditionSql = $this->_getConditionSql('e.'.$attribute, $condition); 01213 } else { 01214 $this->_addAttributeJoin($attribute, $joinType); 01215 if (isset($this->_joinAttributes[$attribute]['condition_alias'])) { 01216 $field = $this->_joinAttributes[$attribute]['condition_alias']; 01217 } 01218 else { 01219 $field = $this->_getAttributeTableAlias($attribute).'.value'; 01220 } 01221 $conditionSql = $this->_getConditionSql($field, $condition); 01222 } 01223 return $conditionSql; 01224 }
_getAttributeFieldName | ( | $ | attributeCode | ) | [protected] |
Reimplemented in Mage_Wishlist_Model_Mysql4_Item_Collection, and Mage_Wishlist_Model_Mysql4_Product_Collection.
Definition at line 1058 of file Abstract.php.
01059 { 01060 if (isset($this->_joinAttributes[$attributeCode]['condition_alias'])) { 01061 return $this->_joinAttributes[$attributeCode]['condition_alias']; 01062 } 01063 if (isset($this->_staticFields[$attributeCode])) { 01064 return sprintf('e.%s', $attributeCode); 01065 } 01066 if (isset($this->_joinFields[$attributeCode])) { 01067 $attr = $this->_joinFields[$attributeCode]; 01068 return $attr['table'] ? $attr['table'] .'.'.$attr['field'] : $attr['field']; 01069 } 01070 01071 $attribute = $this->getAttribute($attributeCode); 01072 if (!$attribute) { 01073 throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid attribute name: %s', $attributeCode)); 01074 } 01075 01076 if ($attribute->isStatic()) { 01077 if (isset($this->_joinAttributes[$attributeCode])) { 01078 $fieldName = $this->_getAttributeTableAlias($attributeCode).'.'.$attributeCode; 01079 } else { 01080 $fieldName = 'e.'.$attributeCode; 01081 } 01082 } else { 01083 $fieldName = $this->_getAttributeTableAlias($attributeCode).'.value'; 01084 } 01085 return $fieldName; 01086 }
_getAttributeTableAlias | ( | $ | attributeCode | ) | [protected] |
Get alias for attribute value table
string | $attributeCode |
Definition at line 1053 of file Abstract.php.
_getLoadAttributesSelect | ( | $ | table, | |
$ | attributeIds = array() | |||
) | [protected] |
Retrieve attributes load select
string | $table |
Reimplemented in Mage_Catalog_Model_Resource_Eav_Mysql4_Collection_Abstract.
Definition at line 1001 of file Abstract.php.
01002 { 01003 if (empty($attributeIds)) { 01004 $attributeIds = $this->_selectAttributes; 01005 } 01006 $entityIdField = $this->getEntity()->getEntityIdField(); 01007 $select = $this->getConnection()->select() 01008 ->from($table, array($entityIdField, 'attribute_id', 'value')) 01009 ->where('entity_type_id=?', $this->getEntity()->getTypeId()) 01010 ->where("$entityIdField in (?)", array_keys($this->_itemsById)) 01011 ->where('attribute_id in (?)', $attributeIds); 01012 return $select; 01013 }
_init | ( | $ | model, | |
$ | entityModel = null | |||
) | [protected] |
Standard resource collection initalization
string | $model |
Reimplemented in Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection.
Definition at line 155 of file Abstract.php.
00156 { 00157 $this->setItemObjectClass(Mage::getConfig()->getModelClassName($model)); 00158 if (is_null($entityModel)) { 00159 $entityModel = $model; 00160 } 00161 $entity = Mage::getResourceSingleton($entityModel); 00162 $this->setEntity($entity); 00163 return $this; 00164 }
_initSelect | ( | ) | [protected] |
Reimplemented in Mage_Bundle_Model_Mysql4_Selection_Collection, Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection, Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Type_Configurable_Product_Collection, Mage_Review_Model_Mysql4_Review_Product_Collection, Mage_Tag_Model_Mysql4_Customer_Collection, and Mage_Tag_Model_Mysql4_Product_Collection.
Definition at line 140 of file Abstract.php.
00141 { 00142 $this->getSelect()->from(array('e'=>$this->getEntity()->getEntityTable())); 00143 if ($this->getEntity()->getTypeId()) { 00144 $this->addAttributeToFilter('entity_type_id', $this->getEntity()->getTypeId()); 00145 } 00146 return $this; 00147 }
_joinAttributeToSelect | ( | $ | method, | |
$ | attribute, | |||
$ | tableAlias, | |||
$ | condition, | |||
$ | fieldCode, | |||
$ | fieldAlias | |||
) | [protected] |
Adding join statement to collection select instance
string | $method | |
object | $attribute | |
string | $tableAlias | |
array | $condition | |
string | $fieldCode | |
string | $fieldAlias |
Reimplemented in Mage_Catalog_Model_Resource_Eav_Mysql4_Collection_Abstract.
Definition at line 1176 of file Abstract.php.
01177 { 01178 $this->getSelect()->$method( 01179 array($tableAlias => $attribute->getBackend()->getTable()), 01180 '('.join(') AND (', $condition).')', 01181 array($fieldCode=>$fieldAlias) 01182 ); 01183 return $this; 01184 }
_loadAttributes | ( | $ | printQuery = false , |
|
$ | logQuery = false | |||
) |
Load attributes into loaded entities
Reimplemented in Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection.
Definition at line 960 of file Abstract.php.
00961 { 00962 if (empty($this->_items) || empty($this->_itemsById) || empty($this->_selectAttributes)) { 00963 return $this; 00964 } 00965 00966 $entity = $this->getEntity(); 00967 $entityIdField = $entity->getEntityIdField(); 00968 00969 $tableAttributes = array(); 00970 foreach ($this->_selectAttributes as $attributeCode => $attributeId) { 00971 $attribute = Mage::getSingleton('eav/config')->getCollectionAttribute($entity->getType(), $attributeCode); 00972 if ($attribute && !$attribute->isStatic()) { 00973 $tableAttributes[$attribute->getBackendTable()][] = $attributeId; 00974 } 00975 } 00976 00977 foreach ($tableAttributes as $table=>$attributes) { 00978 $select = $this->_getLoadAttributesSelect($table); 00979 try { 00980 $values = $this->_fetchAll($select, $attributes); 00981 } catch (Exception $e) { 00982 Mage::printException($e, $select); 00983 $this->printLogQuery(true, true, $select); 00984 throw $e; 00985 } 00986 00987 foreach ($values as $value) { 00988 $this->_setItemAttributeValue($value); 00989 } 00990 } 00991 00992 return $this; 00993 }
_loadEntities | ( | $ | printQuery = false , |
|
$ | logQuery = false | |||
) |
Load entities records into items
Definition at line 922 of file Abstract.php.
00923 { 00924 $entity = $this->getEntity(); 00925 // $entityIdField = $entity->getEntityIdField(); 00926 00927 if ($this->_pageSize) { 00928 $this->getSelect()->limitPage($this->getCurPage(), $this->_pageSize); 00929 } 00930 00931 $this->printLogQuery($printQuery, $logQuery); 00932 00933 try { 00934 $rows = $this->_fetchAll($this->getSelect()); 00935 } catch (Exception $e) { 00936 Mage::printException($e, $this->getSelect()); 00937 $this->printLogQuery(true, true, $this->getSelect()); 00938 throw $e; 00939 } 00940 00941 foreach ($rows as $v) { 00942 $object = $this->getNewEmptyItem() 00943 ->setData($v); 00944 $this->addItem($object); 00945 if (isset($this->_itemsById[$object->getId()])) { 00946 $this->_itemsById[$object->getId()][] = $object; 00947 } 00948 else { 00949 $this->_itemsById[$object->getId()] = array($object); 00950 } 00951 } 00952 return $this; 00953 }
_prepareStaticFields | ( | ) | [protected] |
Prepare static entity fields
Reimplemented in Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection.
Definition at line 132 of file Abstract.php.
00133 { 00134 foreach ($this->getEntity()->getDefaultAttributes() as $field) { 00135 $this->_staticFields[$field] = $field; 00136 } 00137 return $this; 00138 }
_reset | ( | ) | [protected] |
Reset collection
Reimplemented from Varien_Data_Collection_Db.
Definition at line 1272 of file Abstract.php.
01273 { 01274 parent::_reset(); 01275 01276 $this->_selectEntityTypes = array(); 01277 $this->_selectAttributes = array(); 01278 $this->_filterAttributes = array(); 01279 $this->_joinEntities = array(); 01280 $this->_joinAttributes = array(); 01281 $this->_joinFields = array(); 01282 01283 return $this; 01284 }
_setItemAttributeValue | ( | $ | valueInfo | ) | [protected] |
Initialize entity ubject property value
$valueInfo is _getLoadAttributesSelect fetch result row
array | $valueInfo |
Definition at line 1023 of file Abstract.php.
01024 { 01025 $entityIdField = $this->getEntity()->getEntityIdField(); 01026 $entityId = $valueInfo[$entityIdField]; 01027 if (!isset($this->_itemsById[$entityId])) { 01028 Mage::throwException('Mage_Eav', 01029 Mage::helper('eav')->__('Data integrity: No header row found for attribute') 01030 ); 01031 } 01032 $attributeCode = array_search($valueInfo['attribute_id'], $this->_selectAttributes); 01033 if (!$attributeCode) { 01034 $attribute = Mage::getSingleton('eav/config')->getCollectionAttribute( 01035 $this->getEntity()->getType(), 01036 $valueInfo['attribute_id'] 01037 ); 01038 $attributeCode = $attribute->getAttributeCode(); 01039 } 01040 01041 foreach ($this->_itemsById[$entityId] as $object) { 01042 $object->setData($attributeCode, $valueInfo['value']); 01043 } 01044 return $this; 01045 }
addAttributeToFilter | ( | $ | attribute, | |
$ | condition = null , |
|||
$ | joinType = 'inner' | |||
) |
Add attribute filter to collection
If $attribute is an array will add OR condition with following format: array( array('attribute'=>'firstname', 'like'=>'test'), array('attribute'=>'lastname', 'like'=>'test'), )
Mage_Eav_Model_Entity_Attribute_Interface|integer|string|array | $attribute | |
null|string|array | $condition | |
string | $operator |
Reimplemented in Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection, and Mage_Review_Model_Mysql4_Review_Product_Collection.
Definition at line 270 of file Abstract.php.
00271 { 00272 if($attribute===null) { 00273 $this->getSelect(); 00274 return $this; 00275 } 00276 00277 if (is_numeric($attribute)) { 00278 $attribute = $this->getEntity()->getAttribute($attribute)->getAttributeCode(); 00279 } 00280 elseif ($attribute instanceof Mage_Eav_Model_Entity_Attribute_Interface) { 00281 $attribute = $attribute->getAttributeCode(); 00282 } 00283 00284 if (is_array($attribute)) { 00285 $sqlArr = array(); 00286 foreach ($attribute as $condition) { 00287 $sqlArr[] = $this->_getAttributeConditionSql($condition['attribute'], $condition, $joinType); 00288 } 00289 $conditionSql = '('.join(') OR (', $sqlArr).')'; 00290 } elseif (is_string($attribute)) { 00291 if (is_null($condition)) { 00292 $condition = ''; 00293 } 00294 $conditionSql = $this->_getAttributeConditionSql($attribute, $condition, $joinType); 00295 } 00296 00297 if (!empty($conditionSql)) { 00298 $this->getSelect()->where($conditionSql); 00299 } else { 00300 Mage::throwException('Invalid attribute identifier for filter ('.get_class($attribute).')'); 00301 } 00302 00303 return $this; 00304 }
addAttributeToSelect | ( | $ | attribute, | |
$ | joinType = false | |||
) |
Add attribute to entities in collection
If $attribute=='*' select all attributes
array|string|integer|Mage_Core_Model_Config_Element | $attribute | |
false|string | $joinType flag for joining attribute |
Reimplemented in Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection.
Definition at line 364 of file Abstract.php.
00365 { 00366 if (is_array($attribute)) { 00367 Mage::getSingleton('eav/config')->loadCollectionAttributes($this->getEntity()->getType(), $attribute); 00368 foreach ($attribute as $a) { 00369 $this->addAttributeToSelect($a, $joinType); 00370 } 00371 return $this; 00372 } 00373 if ($joinType!==false && !$this->getEntity()->getAttribute($attribute)->isStatic()) { 00374 $this->_addAttributeJoin($attribute, $joinType); 00375 } elseif ('*'===$attribute) { 00376 $attributes = $this->getEntity() 00377 ->loadAllAttributes() 00378 ->getAttributesByCode(); 00379 foreach ($attributes as $attrCode=>$attr) { 00380 $this->_selectAttributes[$attrCode] = $attr->getId(); 00381 } 00382 } else { 00383 if (isset($this->_joinAttributes[$attribute])) { 00384 $attrInstance = $this->_joinAttributes[$attribute]['attribute']; 00385 } else { 00386 //$attrInstance = $this->getEntity()->getAttribute($attribute); 00387 $attrInstance = Mage::getSingleton('eav/config')->getCollectionAttribute($this->getEntity()->getType(), $attribute); 00388 } 00389 if (empty($attrInstance)) { 00390 throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid attribute requested: %s', (string)$attribute)); 00391 } 00392 $this->_selectAttributes[$attrInstance->getAttributeCode()] = $attrInstance->getId(); 00393 } 00394 return $this; 00395 }
addAttributeToSort | ( | $ | attribute, | |
$ | dir = 'asc' | |||
) |
Add attribute to sort order
string | $attribute | |
string | $dir |
Reimplemented in Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection, Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Link_Product_Collection, and Mage_Reports_Model_Mysql4_Review_Product_Collection.
Definition at line 324 of file Abstract.php.
00325 { 00326 if (isset($this->_joinFields[$attribute])) { 00327 $this->getSelect()->order($this->_getAttributeFieldName($attribute).' '.$dir); 00328 return $this; 00329 } 00330 if (isset($this->_staticFields[$attribute])) { 00331 $this->getSelect()->order("e.{$attribute} {$dir}"); 00332 } 00333 if (isset($this->_joinAttributes[$attribute])) { 00334 $attrInstance = $this->_joinAttributes[$attribute]['attribute']; 00335 $entityField = $this->_getAttributeTableAlias($attribute).'.'.$attrInstance->getAttributeCode(); 00336 } else { 00337 $attrInstance = $this->getEntity()->getAttribute($attribute); 00338 $entityField = 'e.'.$attribute; 00339 } 00340 if ($attrInstance) { 00341 if ($attrInstance->getBackend()->isStatic()) { 00342 $this->getSelect()->order($entityField.' '.$dir); 00343 } else { 00344 $this->_addAttributeJoin($attribute, 'left'); 00345 if (isset($this->_joinAttributes[$attribute])) { 00346 $this->getSelect()->order($attribute.' '.$dir); 00347 } else { 00348 $this->getSelect()->order($this->_getAttributeTableAlias($attribute).'.value '.$dir); 00349 } 00350 } 00351 } 00352 return $this; 00353 }
addEntityTypeToSelect | ( | $ | entityType, | |
$ | prefix | |||
) |
Definition at line 397 of file Abstract.php.
00398 { 00399 $this->_selectEntityTypes[$entityType] = array( 00400 'prefix'=>$prefix, 00401 ); 00402 return $this; 00403 }
addExpressionAttributeToSelect | ( | $ | alias, | |
$ | expression, | |||
$ | attribute | |||
) |
Add attribute expression (SUM, COUNT, etc)
Example: ('sub_total', 'SUM({{attribute}})', 'revenue') Example: ('sub_total', 'SUM({{revenue}})', 'revenue')
For some functions like SUM use groupByAttribute.
string | $alias | |
string | $expression | |
string | $attribute |
Definition at line 432 of file Abstract.php.
00433 { 00434 // validate alias 00435 if (isset($this->_joinFields[$alias])) { 00436 throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Joined field or attribute expression with this alias is already declared')); 00437 } 00438 if(!is_array($attribute)) { 00439 $attribute = array($attribute); 00440 } 00441 00442 $fullExpression = $expression; 00443 // Replacing multiple attributes 00444 foreach($attribute as $attributeItem) { 00445 if (isset($this->_staticFields[$attributeItem])) { 00446 $attrField = sprintf('e.%s', $attributeItem); 00447 } 00448 else { 00449 $attributeInstance = $this->getAttribute($attributeItem); 00450 00451 if ($attributeInstance->getBackend()->isStatic()) { 00452 $attrField = 'e.' . $attributeItem; 00453 } else { 00454 $this->_addAttributeJoin($attributeItem, 'left'); 00455 $attrField = $this->_getAttributeFieldName($attributeItem); 00456 } 00457 } 00458 00459 $fullExpression = str_replace('{{attribute}}', $attrField, $fullExpression); 00460 $fullExpression = str_replace('{{' . $attributeItem . '}}', $attrField, $fullExpression); 00461 } 00462 00463 $this->getSelect()->from(null, array($alias=>$fullExpression)); 00464 00465 $this->_joinFields[$alias] = array( 00466 'table' => false, 00467 'field' => $fullExpression 00468 ); 00469 00470 return $this; 00471 }
addFieldToFilter | ( | $ | attribute, | |
$ | condition = null | |||
) |
Wrapper for compatibility with Varien_Data_Collection_Db
mixed | $attribute | |
mixed | $condition |
Reimplemented from Varien_Data_Collection_Db.
Reimplemented in Mage_Reports_Model_Mysql4_Product_Downloads_Collection, and Mage_Tag_Model_Mysql4_Customer_Collection.
Definition at line 312 of file Abstract.php.
00313 { 00314 return $this->addAttributeToFilter($attribute, $condition); 00315 }
addItem | ( | Varien_Object $ | object | ) |
Add an object to the collection
Varien_Object | $object |
Reimplemented from Varien_Data_Collection.
Definition at line 232 of file Abstract.php.
00233 { 00234 if (get_class($object)!== $this->_itemObjectClass) { 00235 throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Attempt to add an invalid object')); 00236 } 00237 return parent::addItem($object); 00238 }
addStaticField | ( | $ | field | ) |
Add field to static
string | $field |
Definition at line 411 of file Abstract.php.
00412 { 00413 if (!isset($this->_staticFields[$field])) { 00414 $this->_staticFields[$field] = $field; 00415 } 00416 return $this; 00417 }
delete | ( | ) |
Delete all the entities in the collection
Definition at line 856 of file Abstract.php.
00857 { 00858 foreach ($this->getItems() as $k=>$item) { 00859 $this->getEntity()->delete($item); 00860 unset($this->_items[$k]); 00861 } 00862 return $this; 00863 }
exportToArray | ( | ) |
Get collection data as a 2D array
Definition at line 893 of file Abstract.php.
00894 { 00895 $result = array(); 00896 $entityIdField = $this->getEntity()->getEntityIdField(); 00897 foreach ($this->getItems() as $item) { 00898 $result[$item->getData($entityIdField)] = $item->getData(); 00899 } 00900 return $result; 00901 }
getAllIds | ( | $ | limit = null , |
|
$ | offset = null | |||
) |
Retrive all ids for collection
Reimplemented in Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection, Mage_Customer_Model_Entity_Customer_Collection, Mage_Review_Model_Mysql4_Review_Product_Collection, and Mage_Sales_Model_Mysql4_Order_Collection.
Definition at line 808 of file Abstract.php.
00809 { 00810 $idsSelect = clone $this->getSelect(); 00811 $idsSelect->reset(Zend_Db_Select::ORDER); 00812 $idsSelect->reset(Zend_Db_Select::LIMIT_COUNT); 00813 $idsSelect->reset(Zend_Db_Select::LIMIT_OFFSET); 00814 $idsSelect->reset(Zend_Db_Select::COLUMNS); 00815 $idsSelect->from(null, 'e.'.$this->getEntity()->getIdFieldName()); 00816 $idsSelect->limit($limit, $offset); 00817 return $this->getConnection()->fetchCol($idsSelect, $this->_bindParams); 00818 }
getAllIdsSql | ( | ) |
Retrive all ids sql
Definition at line 825 of file Abstract.php.
00826 { 00827 $idsSelect = clone $this->getSelect(); 00828 $idsSelect->reset(Zend_Db_Select::ORDER); 00829 $idsSelect->reset(Zend_Db_Select::LIMIT_COUNT); 00830 $idsSelect->reset(Zend_Db_Select::LIMIT_OFFSET); 00831 $idsSelect->reset(Zend_Db_Select::COLUMNS); 00832 $idsSelect->reset(Zend_Db_Select::GROUP); 00833 $idsSelect->from(null, 'e.'.$this->getEntity()->getIdFieldName()); 00834 return $idsSelect; 00835 }
getAttribute | ( | $ | attributeCode | ) |
Retrieve entity attribute
string | $attributeCode |
Definition at line 246 of file Abstract.php.
00247 { 00248 if (isset($this->_joinAttributes[$attributeCode])) { 00249 return $this->_joinAttributes[$attributeCode]['attribute']; 00250 } else { 00251 return $this->getEntity()->getAttribute($attributeCode); 00252 } 00253 }
getEntity | ( | ) |
Get collection's entity object
Definition at line 189 of file Abstract.php.
00190 { 00191 if (empty($this->_entity)) { 00192 throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Entity is not initialized')); 00193 } 00194 return $this->_entity; 00195 }
getLoadedIds | ( | ) |
getResource | ( | ) |
Get resource instance
Definition at line 202 of file Abstract.php.
00203 { 00204 return $this->getEntity(); 00205 }
getRowIdFieldName | ( | ) |
Definition at line 904 of file Abstract.php.
00905 { 00906 if (is_null($this->_idFieldName)) { 00907 $this->_setIdFieldName($this->getEntity()->getIdFieldName()); 00908 } 00909 return $this->getIdFieldName(); 00910 }
getTable | ( | $ | table | ) |
Definition at line 122 of file Abstract.php.
00123 { 00124 return $this->getResource()->getTable($table); 00125 }
groupByAttribute | ( | $ | attribute | ) |
Groups results by specified attribute
string|array | $attribute |
Definition at line 479 of file Abstract.php.
00480 { 00481 if(is_array($attribute)) { 00482 foreach ($attribute as $attributeItem) { 00483 $this->groupByAttribute($attributeItem); 00484 } 00485 } else { 00486 if (isset($this->_joinFields[$attribute])) { 00487 $this->getSelect()->group($this->_getAttributeFieldName($attribute)); 00488 return $this; 00489 } 00490 00491 if (isset($this->_staticFields[$attribute])) { 00492 $this->getSelect()->group(sprintf('e.%s', $attribute)); 00493 return $this; 00494 } 00495 00496 if (isset($this->_joinAttributes[$attribute])) { 00497 $attrInstance = $this->_joinAttributes[$attribute]['attribute']; 00498 $entityField = $this->_getAttributeTableAlias($attribute).'.'.$attrInstance->getAttributeCode(); 00499 } else { 00500 $attrInstance = $this->getEntity()->getAttribute($attribute); 00501 $entityField = 'e.'.$attribute; 00502 } 00503 00504 if ($attrInstance->getBackend()->isStatic()) { 00505 $this->getSelect()->group($entityField); 00506 } else { 00507 $this->_addAttributeJoin($attribute); 00508 $this->getSelect()->group($this->_getAttributeTableAlias($attribute).'.value'); 00509 } 00510 } 00511 00512 return $this; 00513 }
importFromArray | ( | $ | arr | ) |
Import 2D array into collection as objects
If the imported items already exist, update the data for existing objects
array | $arr |
Definition at line 873 of file Abstract.php.
00874 { 00875 $entityIdField = $this->getEntity()->getEntityIdField(); 00876 foreach ($arr as $row) { 00877 $entityId = $row[$entityIdField]; 00878 if (!isset($this->_items[$entityId])) { 00879 $this->_items[$entityId] = $this->getNewEmptyItem(); 00880 $this->_items[$entityId]->setData($row); 00881 } else { 00882 $this->_items[$entityId]->addData($row); 00883 } 00884 } 00885 return $this; 00886 }
joinAttribute | ( | $ | alias, | |
$ | attribute, | |||
$ | bind, | |||
$ | filter = null , |
|||
$ | joinType = 'inner' , |
|||
$ | storeId = null | |||
) |
Add attribute from joined entity to select
Examples: ('billing_firstname', 'customer_address/firstname', 'default_billing') ('billing_lastname', 'customer_address/lastname', 'default_billing') ('shipping_lastname', 'customer_address/lastname', 'default_billing') ('shipping_postalcode', 'customer_address/postalcode', 'default_shipping') ('shipping_city', $cityAttribute, 'default_shipping')
Developer is encouraged to use existing instances of attributes and entities After first use of string entity name it will be cached in the collection
string | $alias alias for the joined attribute | |
string|Mage_Eav_Model_Entity_Attribute_Abstract | $attribute | |
string | $bind attribute of the main entity to link with joined $filter | |
string | $filter primary key for the joined entity (entity_id default) | |
string | $joinType inner|left |
Definition at line 536 of file Abstract.php.
00537 { 00538 // validate alias 00539 if (isset($this->_joinAttributes[$alias])) { 00540 throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid alias, already exists in joined attributes')); 00541 } 00542 00543 // validate bind attribute 00544 if (is_string($bind)) { 00545 $bindAttribute = $this->getAttribute($bind); 00546 } 00547 00548 if (!$bindAttribute || (!$bindAttribute->isStatic() && !$bindAttribute->getId())) { 00549 throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid foreign key')); 00550 } 00551 00552 // try to explode combined entity/attribute if supplied 00553 if (is_string($attribute)) { 00554 $attrArr = explode('/', $attribute); 00555 if (isset($attrArr[1])) { 00556 $entity = $attrArr[0]; 00557 $attribute = $attrArr[1]; 00558 } 00559 } 00560 00561 // validate entity 00562 if (empty($entity) && $attribute instanceof Mage_Eav_Model_Entity_Attribute_Abstract) { 00563 $entity = $attribute->getEntity(); 00564 } elseif (is_string($entity)) { 00565 // retrieve cached entity if possible 00566 if (isset($this->_joinEntities[$entity])) { 00567 $entity = $this->_joinEntities[$entity]; 00568 } else { 00569 $entity = Mage::getModel('eav/entity')->setType($attrArr[0]); 00570 } 00571 } 00572 if (!$entity || !$entity->getTypeId()) { 00573 throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid entity type')); 00574 } 00575 00576 // cache entity 00577 if (!isset($this->_joinEntities[$entity->getType()])) { 00578 $this->_joinEntities[$entity->getType()] = $entity; 00579 } 00580 00581 // validate attribute 00582 if (is_string($attribute)) { 00583 $attribute = $entity->getAttribute($attribute); 00584 } 00585 if (!$attribute) { 00586 throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid attribute type')); 00587 } 00588 00589 if (empty($filter)) { 00590 $filter = $entity->getEntityIdField(); 00591 } 00592 00593 // add joined attribute 00594 $this->_joinAttributes[$alias] = array( 00595 'bind' => $bind, 00596 'bindAttribute' => $bindAttribute, 00597 'attribute' => $attribute, 00598 'filter' => $filter, 00599 'store_id' => $storeId, 00600 ); 00601 00602 $this->_addAttributeJoin($alias, $joinType); 00603 00604 return $this; 00605 }
joinField | ( | $ | alias, | |
$ | table, | |||
$ | field, | |||
$ | bind, | |||
$ | cond = null , |
|||
$ | joinType = 'inner' | |||
) |
Join regular table field and use an attribute as fk
Examples: ('country_name', 'directory/country_name', 'name', 'country_id=shipping_country', "{{table}}.language_code='en'", 'left')
string | $alias 'country_name' | |
string | $table 'directory/country_name' | |
string | $field 'name' | |
string | $bind 'PK(country_id)=FK(shipping_country_id)' | |
string|array | $cond "{{table}}.language_code='en'" OR array('language_code'=>'en') | |
string | $joinType 'left' |
Definition at line 621 of file Abstract.php.
00622 { 00623 // validate alias 00624 if (isset($this->_joinFields[$alias])) { 00625 throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Joined field with this alias is already declared')); 00626 } 00627 00628 // validate table 00629 if (strpos($table, '/')!==false) { 00630 $table = Mage::getSingleton('core/resource')->getTableName($table); 00631 } 00632 $tableAlias = $this->_getAttributeTableAlias($alias); 00633 00634 // validate bind 00635 list($pk, $fk) = explode('=', $bind); 00636 $bindCond = $tableAlias.'.'.$pk.'='.$this->_getAttributeFieldName($fk); 00637 00638 // process join type 00639 switch ($joinType) { 00640 case 'left': 00641 $joinMethod = 'joinLeft'; 00642 break; 00643 00644 default: 00645 $joinMethod = 'join'; 00646 } 00647 $condArr = array($bindCond); 00648 00649 // add where condition if needed 00650 if (!is_null($cond)) { 00651 if (is_array($cond)) { 00652 foreach ($cond as $k=>$v) { 00653 $condArr[] = $this->_getConditionSql($tableAlias.'.'.$k, $v); 00654 } 00655 } else { 00656 $condArr[] = str_replace('{{table}}', $tableAlias, $cond); 00657 } 00658 } 00659 $cond = '('.join(') AND (', $condArr).')'; 00660 00661 // join table 00662 $this->getSelect()->$joinMethod(array($tableAlias=>$table), $cond, ($field ? array($alias=>$field) : array())); 00663 00664 // save joined attribute 00665 $this->_joinFields[$alias] = array( 00666 'table'=>$tableAlias, 00667 'field'=>$field, 00668 ); 00669 00670 return $this; 00671 }
joinTable | ( | $ | table, | |
$ | bind, | |||
$ | fields = null , |
|||
$ | cond = null , |
|||
$ | joinType = 'inner' | |||
) |
Join a table
string | $table | |
string | $bind | |
string|array | $fields | |
null|array | $cond | |
string | $joinType |
Definition at line 683 of file Abstract.php.
00684 { 00685 // validate table 00686 if (strpos($table, '/')!==false) { 00687 $table = Mage::getSingleton('core/resource')->getTableName($table); 00688 } 00689 $tableAlias = $table; 00690 00691 // validate fields and aliases 00692 if (!$fields) { 00693 throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid joined fields')); 00694 } 00695 foreach ($fields as $alias=>$field) { 00696 if (isset($this->_joinFields[$alias])) { 00697 throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Joined field with this alias (%s) is already declared', $alias)); 00698 } 00699 $this->_joinFields[$alias] = array( 00700 'table'=>$tableAlias, 00701 'field'=>$field, 00702 ); 00703 } 00704 00705 // validate bind 00706 list($pk, $fk) = explode('=', $bind); 00707 $bindCond = $tableAlias.'.'.$pk.'='.$this->_getAttributeFieldName($fk); 00708 00709 // process join type 00710 switch ($joinType) { 00711 case 'left': 00712 $joinMethod = 'joinLeft'; 00713 break; 00714 00715 default: 00716 $joinMethod = 'join'; 00717 } 00718 $condArr = array($bindCond); 00719 00720 // add where condition if needed 00721 if (!is_null($cond)) { 00722 if (is_array($cond)) { 00723 foreach ($cond as $k=>$v) { 00724 $condArr[] = $this->_getConditionSql($tableAlias.'.'.$k, $v); 00725 } 00726 } else { 00727 $condArr[] = str_replace('{{table}}', $tableAlias, $cond); 00728 } 00729 } 00730 $cond = '('.join(') AND (', $condArr).')'; 00731 00732 // join table 00733 $this->getSelect()->$joinMethod(array($tableAlias=>$table), $cond, $fields); 00734 00735 return $this; 00736 }
load | ( | $ | printQuery = false , |
|
$ | logQuery = false | |||
) |
Load collection data into object items
Reimplemented from Varien_Data_Collection_Db.
Reimplemented in Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection, Mage_Tag_Model_Entity_Customer_Collection, and Mage_Wishlist_Model_Mysql4_Item_Collection.
Definition at line 773 of file Abstract.php.
00774 { 00775 if ($this->isLoaded()) { 00776 return $this; 00777 } 00778 Varien_Profiler::start('__EAV_COLLECTION_BEFORE_LOAD__'); 00779 Mage::dispatchEvent('eav_collection_abstract_load_before', array('collection' => $this)); 00780 $this->_beforeLoad(); 00781 Varien_Profiler::stop('__EAV_COLLECTION_BEFORE_LOAD__'); 00782 00783 Varien_Profiler::start('__EAV_COLLECTION_LOAD_ENT__'); 00784 $this->_loadEntities($printQuery, $logQuery); 00785 Varien_Profiler::stop('__EAV_COLLECTION_LOAD_ENT__'); 00786 Varien_Profiler::start('__EAV_COLLECTION_LOAD_ATTR__'); 00787 $this->_loadAttributes($printQuery, $logQuery); 00788 Varien_Profiler::stop('__EAV_COLLECTION_LOAD_ATTR__'); 00789 00790 Varien_Profiler::start('__EAV_COLLECTION_ORIG_DATA__'); 00791 foreach ($this->_items as $item) { 00792 $item->setOrigData(); 00793 } 00794 Varien_Profiler::stop('__EAV_COLLECTION_ORIG_DATA__'); 00795 00796 $this->_setIsLoaded(); 00797 Varien_Profiler::start('__EAV_COLLECTION_AFTER_LOAD__'); 00798 $this->_afterLoad(); 00799 Varien_Profiler::stop('__EAV_COLLECTION_AFTER_LOAD__'); 00800 return $this; 00801 }
removeAttributeToSelect | ( | $ | attribute = null |
) |
Remove an attribute from selection list
string | $attribute |
Definition at line 744 of file Abstract.php.
00745 { 00746 if (is_null($attribute)) { 00747 $this->_selectAttributes = array(); 00748 } else { 00749 unset($this->_selectAttributes[$attribute]); 00750 } 00751 return $this; 00752 }
save | ( | ) |
Save all the entities in the collection
Definition at line 842 of file Abstract.php.
00843 { 00844 foreach ($this->getItems() as $item) { 00845 $item->save(); 00846 } 00847 return $this; 00848 }
setEntity | ( | $ | entity | ) |
Set entity to use for attributes
Mage_Eav_Model_Entity_Abstract | $entity |
Reimplemented in Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection.
Definition at line 172 of file Abstract.php.
00173 { 00174 if ($entity instanceof Mage_Eav_Model_Entity_Abstract) { 00175 $this->_entity = $entity; 00176 } elseif (is_string($entity) || $entity instanceof Mage_Core_Model_Config_Element) { 00177 $this->_entity = Mage::getModel('eav/entity')->setType($entity); 00178 } else { 00179 Mage::throwException(Mage::helper('eav')->__('Invalid entity supplied: %s', print_r($entity,1))); 00180 } 00181 return $this; 00182 }
setObject | ( | $ | object = null |
) |
Set template object for the collection
Varien_Object | $object |
Definition at line 213 of file Abstract.php.
00214 { 00215 if (is_object($object)) { 00216 $this->setItemObjectClass(get_class($object)); 00217 } 00218 else { 00219 $this->setItemObjectClass($object); 00220 } 00221 00222 return $this; 00223 }
setOrder | ( | $ | attribute, | |
$ | dir = 'desc' | |||
) |
Set sorting order
$attribute can also be an array of attributes
string|array | $attribute | |
string | $dir |
Reimplemented from Varien_Data_Collection_Db.
Reimplemented in Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection, Mage_Reports_Model_Mysql4_Product_Collection, Mage_Reports_Model_Mysql4_Product_Downloads_Collection, Mage_Reports_Model_Mysql4_Tag_Customer_Collection, Mage_Reports_Model_Mysql4_Tag_Product_Collection, Mage_Reports_Model_Mysql4_Wishlist_Product_Collection, Mage_Review_Model_Mysql4_Review_Product_Collection, Mage_Tag_Model_Mysql4_Customer_Collection, and Mage_Tag_Model_Mysql4_Product_Collection.
Definition at line 1235 of file Abstract.php.
01236 { 01237 if (is_array($attribute)) { 01238 foreach ($attribute as $attr) { 01239 $this->addAttributeToSort($attr, $dir); 01240 } 01241 } else { 01242 $this->addAttributeToSort($attribute, $dir); 01243 } 01244 return $this; 01245 }
setPage | ( | $ | pageNum, | |
$ | pageSize | |||
) |
Set collection page start and records to show
integer | $pageNum | |
integer | $pageSize |
Definition at line 761 of file Abstract.php.
00762 { 00763 $this->setCurPage($pageNum) 00764 ->setPageSize($pageSize); 00765 return $this; 00766 }
setRowIdFieldName | ( | $ | fieldName | ) |
Definition at line 912 of file Abstract.php.
00913 { 00914 return $this->_setIdFieldName($fieldName); 00915 }
toArray | ( | $ | arrRequiredFields = array() |
) |
Convert collection to array
Reimplemented from Varien_Data_Collection.
Definition at line 1248 of file Abstract.php.
01249 { 01250 $arr = array(); 01251 foreach ($this->_items as $k=>$item) { 01252 $arr[$k] = $item->toArray($arrAttributes); 01253 } 01254 return $arr; 01255 }
$_entity [protected] |
Definition at line 56 of file Abstract.php.
$_filterAttributes = array() [protected] |
Definition at line 77 of file Abstract.php.
$_itemsById = array() [protected] |
Definition at line 42 of file Abstract.php.
$_joinAttributes = array() [protected] |
Definition at line 91 of file Abstract.php.
$_joinEntities = array() [protected] |
Definition at line 84 of file Abstract.php.
$_joinFields = array() [protected] |
Definition at line 98 of file Abstract.php.
$_selectAttributes = array() [protected] |
Definition at line 70 of file Abstract.php.
$_selectEntityTypes = array() [protected] |
Definition at line 63 of file Abstract.php.
$_staticFields = array() [protected] |
Definition at line 49 of file Abstract.php.