Class Mage_Eav_Model_Entity_Collection_Abstract

Description

Entity/Attribute/Model - collection abstract

Located in /Eav/Model/Entity/Collection/Abstract.php (line 34)

Varien_Data_Collection_Db
   |
   --Mage_Eav_Model_Entity_Collection_Abstract
Direct descendents
Class Description
Mage_Catalog_Model_Resource_Eav_Mysql4_Collection_Abstract Catalog EAV collection resource abstract model
Mage_Customer_Model_Entity_Customer_Collection Customers collection
Mage_Customer_Model_Entity_Address_Collection Customers collection
Mage_Customer_Model_Entity_Wishlist_Collection Customers collection
Mage_Sales_Model_Entity_Quote_Collection Quotes collection
Mage_Sales_Model_Entity_Quote_Item_Collection Quote addresses collection
Mage_Sales_Model_Entity_Quote_Payment_Collection Quote addresses collection
Mage_Sales_Model_Entity_Quote_Address_Collection Quote addresses collection
Mage_Sales_Model_Entity_Quote_Address_Item_Collection Quote addresses collection
Mage_Sales_Model_Entity_Quote_Address_Rate_Collection Quote addresses collection
Mage_Sales_Model_Entity_Order_Invoice_Comment_Collection Invoice comments collection
Mage_Sales_Model_Entity_Order_Invoice_Collection Invoices collection
Mage_Sales_Model_Entity_Order_Invoice_Item_Collection Invoice items collection
Mage_Sales_Model_Entity_Order_Collection Orders collection
Mage_Sales_Model_Entity_Order_Item_Collection Order status collection
Mage_Sales_Model_Entity_Order_Payment_Collection Order status collection
Mage_Sales_Model_Entity_Order_Creditmemo_Comment_Collection Creditmemo comments collection
Mage_Sales_Model_Entity_Order_Creditmemo_Collection Creditmemos collection
Mage_Sales_Model_Entity_Order_Creditmemo_Item_Collection Quote creditmemo items collection
Mage_Sales_Model_Entity_Order_Address_Collection Order address collection
Mage_Sales_Model_Entity_Order_Status_History_Collection Order status history collection
Mage_Sales_Model_Entity_Order_Shipment_Comment_Collection Shipment comments collection
Mage_Sales_Model_Entity_Order_Shipment_Collection Shipment collection
Mage_Sales_Model_Entity_Order_Shipment_Item_Collection Order shipment items collection
Mage_Sales_Model_Entity_Order_Shipment_Track_Collection Order shipment track collection
Mage_Eav_Model_Entity_Collection Magento
Variable Summary
Method Summary
Mage_Eav_Model_Entity_Collection_Abstract __construct ([Mage_Core_Model_Mysql4_Abstract $resource = null])
Mage_Eav_Model_Entity_Collection_Abstract addAttributeToFilter (Mage_Eav_Model_Entity_Attribute_Interface|integer|string|array $attribute, [null|string|array $condition = null], [ $joinType = 'inner'], string $operator)
Mage_Eav_Model_Entity_Collection_Abstract addAttributeToSelect (array|string|integer|Mage_Core_Model_Config_Element $attribute, [false|string $joinType = false])
Mage_Eav_Model_Entity_Collection_Abstract addAttributeToSort (string $attribute, [string $dir = 'asc'])
void addEntityTypeToSelect ( $entityType,  $prefix)
Mage_Eav_Model_Entity_Collection_Abstract addExpressionAttributeToSelect (string $alias, string $expression, string $attribute)
void addFieldToFilter (mixed $attribute, [mixed $condition = null])
void delete ()
array exportToArray ()
array getAllIds ([ $limit = null], [ $offset = null])
array getAllIdsSql ()
void getLoadedIds ()
void getTable ( $table)
void groupByAttribute (string|array $attribute)
Mage_Eav_Model_Entity_Collection_Abstract joinAttribute (string $alias, string|Mage_Eav_Model_Entity_Attribute_Abstract $attribute, string $bind, [string $filter = null], [string $joinType = 'inner'], [ $storeId = null])
Mage_Eav_Model_Entity_Collection_Abstract joinField (string $alias, string $table, string $field, string $bind, [string|array $cond = null], [string $joinType = 'inner'])
Mage_Eav_Model_Entity_Collection_Abstract joinTable (string|array $table, string $bind, [string|array $fields = null], [null|array $cond = null], [string $joinType = 'inner'])
Mage_Eav_Model_Entity_Collection_Abstract load ([ $printQuery = false], [ $logQuery = false])
void save ()
Mage_Eav_Model_Entity_Collection_Abstract setObject ([Varien_Object $object = null])
Mage_Eav_Model_Entity_Collection_Abstract setOrder (string|array $attribute, [string $dir = 'desc'])
Mage_Eav_Model_Entity_Collection_Abstract setPage (integer $pageNum, integer $pageSize)
void setRowIdFieldName ( $fieldName)
void toArray ([ $arrAttributes = array()])
Mage_Eav_Model_Entity_Collection_Abstract _addAttributeJoin (string $attributeCode, [string $joinType = 'inner'])
void _afterLoad ()
void _beforeLoad ()
void _construct ()
Mage_Eav_Model_Entity_Collection_Abstract _getAllIdsSelect ([ $limit = null], [ $offset = null])
string _getAttributeConditionSql (string $attribute, mixed $condition, [string $joinType = 'inner'])
void _getAttributeFieldName ( $attributeCode)
string _getAttributeTableAlias (string $attributeCode)
Mage_Eav_Model_Entity_Collection_Abstract _getLoadAttributesSelect (string $table, [ $attributeIds = array()])
Mage_Core_Model_Mysql4_Collection_Abstract _init (string $model, [ $entityModel = null])
void _initSelect ()
Mage_Eav_Model_Entity_Collection_Abstract _joinAttributeToSelect (string $method, object $attribute, string $tableAlias, array $condition, string $fieldCode, string $fieldAlias)
Mage_Eav_Model_Entity_Collection_Abstract _loadAttributes ([ $printQuery = false], [ $logQuery = false])
Mage_Eav_Model_Entity_Collection_Abstract _loadEntities ([ $printQuery = false], [ $logQuery = false])
Variables
Mage_Eav_Model_Entity_Abstract $_entity (line 55)

Entity object to define collection's attributes

  • access: protected
array $_filterAttributes = array() (line 76)

Attributes to be filtered order sorted by

  • access: protected
array $_itemsById = array() (line 41)

Array of items with item id key

  • access: protected
array $_joinAttributes = array() (line 90)

Joined attributes

  • access: protected
array $_joinEntities = array() (line 83)

Joined entities

  • access: protected
array $_joinFields = array() (line 97)

Joined fields data

  • access: protected
array $_selectAttributes = array() (line 69)

Attributes to be fetched for objects in collection

  • access: protected
array $_selectEntityTypes = array() (line 62)

Entity types to be fetched for objects in collection

  • access: protected
array $_staticFields = array() (line 48)

Entity static fields

  • access: protected
Methods
Constructor __construct (line 104)

Collection constructor

  • access: public
Mage_Eav_Model_Entity_Collection_Abstract __construct ([Mage_Core_Model_Mysql4_Abstract $resource = null])

Redefined in descendants as:
addAttributeToFilter (line 269)

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%'), )

  • see: self::_getConditionSql for $condition
  • access: public
Mage_Eav_Model_Entity_Collection_Abstract addAttributeToFilter (Mage_Eav_Model_Entity_Attribute_Interface|integer|string|array $attribute, [null|string|array $condition = null], [ $joinType = 'inner'], string $operator)

Redefined in descendants as:
addAttributeToSelect (line 362)

Add attribute to entities in collection

If $attribute=='*' select all attributes

  • access: public
Mage_Eav_Model_Entity_Collection_Abstract addAttributeToSelect (array|string|integer|Mage_Core_Model_Config_Element $attribute, [false|string $joinType = false])

Redefined in descendants as:
addAttributeToSort (line 322)

Add attribute to sort order

  • access: public
Mage_Eav_Model_Entity_Collection_Abstract addAttributeToSort (string $attribute, [string $dir = 'asc'])
  • string $attribute
  • string $dir

Redefined in descendants as:
addEntityTypeToSelect (line 395)
  • access: public
void addEntityTypeToSelect ( $entityType,  $prefix)
  • $entityType
  • $prefix
addExpressionAttributeToSelect (line 430)

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.

  • access: public
Mage_Eav_Model_Entity_Collection_Abstract addExpressionAttributeToSelect (string $alias, string $expression, string $attribute)
  • string $alias
  • string $expression
  • string $attribute
addFieldToFilter (line 310)

Wrapper for compatibility with Varien_Data_Collection_Db

  • access: public
void addFieldToFilter (mixed $attribute, [mixed $condition = null])
  • mixed $attribute
  • mixed $condition

Redefined in descendants as:
addItem (line 231)

Add an object to the collection

  • access: public
  • Varien_Object $object
addStaticField (line 409)

Add field to static

  • access: public
Mage_Eav_Model_Entity_Collection_Abstract addStaticField (string $field)
  • string $field
delete (line 876)

Delete all the entities in the collection

  • todo: make batch delete directly from collection
  • access: public
void delete ()
exportToArray (line 913)

Get collection data as a 2D array

  • access: public
array exportToArray ()
getAllIds (line 835)

Retrive all ids for collection

  • access: public
array getAllIds ([ $limit = null], [ $offset = null])
  • $limit
  • $offset

Redefined in descendants as:
getAllIdsSql (line 845)

Retrive all ids sql

  • access: public
array getAllIdsSql ()
getAttribute (line 245)

Retrieve entity attribute

  • access: public
Mage_Eav_Model_Entity_Attribute_Abstract getAttribute (string $attributeCode)
  • string $attributeCode
getEntity (line 188)

Get collection's entity object

  • access: public
getLoadedIds (line 1318)

Returns already loaded element ids

return array

  • access: public
void getLoadedIds ()
getResource (line 201)

Get resource instance

  • access: public
getRowIdFieldName (line 924)
  • access: public
void getRowIdFieldName ()
getTable (line 121)
  • access: public
void getTable ( $table)
  • $table
groupByAttribute (line 477)

Groups results by specified attribute

  • access: public
void groupByAttribute (string|array $attribute)
  • string|array $attribute
importFromArray (line 893)

Import 2D array into collection as objects

If the imported items already exist, update the data for existing objects

  • access: public
Mage_Eav_Model_Entity_Collection_Abstract importFromArray (array $arr)
  • array $arr
joinAttribute (line 534)

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

  • todo: connect between joined attributes of same entity
  • access: public
Mage_Eav_Model_Entity_Collection_Abstract joinAttribute (string $alias, string|Mage_Eav_Model_Entity_Attribute_Abstract $attribute, string $bind, [string $filter = null], [string $joinType = 'inner'], [ $storeId = null])
  • 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
  • $storeId
joinField (line 619)

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')

  • access: public
Mage_Eav_Model_Entity_Collection_Abstract joinField (string $alias, string $table, string $field, string $bind, [string|array $cond = null], [string $joinType = 'inner'])
  • 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'
joinTable (line 681)

Join a table

  • access: public
Mage_Eav_Model_Entity_Collection_Abstract joinTable (string|array $table, string $bind, [string|array $fields = null], [null|array $cond = null], [string $joinType = 'inner'])
  • string|array $table
  • string $bind
  • string|array $fields
  • null|array $cond
  • string $joinType
load (line 781)

Load collection data into object items

  • access: public
Mage_Eav_Model_Entity_Collection_Abstract load ([ $printQuery = false], [ $logQuery = false])
  • $printQuery
  • $logQuery

Redefined in descendants as:
removeAttributeToSelect (line 752)

Remove an attribute from selection list

  • access: public
Mage_Eav_Model_Entity_Collection_Abstract removeAttributeToSelect ([string $attribute = null])
  • string $attribute
save (line 862)

Save all the entities in the collection

  • todo: make batch save directly from collection
  • access: public
void save ()
setEntity (line 171)

Set entity to use for attributes

  • access: public

Redefined in descendants as:
setObject (line 212)

Set template object for the collection

  • access: public
Mage_Eav_Model_Entity_Collection_Abstract setObject ([Varien_Object $object = null])
  • Varien_Object $object
setPage (line 769)

Set collection page start and records to show

  • access: public
Mage_Eav_Model_Entity_Collection_Abstract setPage (integer $pageNum, integer $pageSize)
  • integer $pageNum
  • integer $pageSize
setRowIdFieldName (line 932)
  • access: public
void setRowIdFieldName ( $fieldName)
  • $fieldName
toArray (line 1275)
  • access: public
void toArray ([ $arrAttributes = array()])
  • $arrAttributes
_addAttributeJoin (line 1121)

Add attribute value table to the join if it wasn't added previously

  • access: protected
Mage_Eav_Model_Entity_Collection_Abstract _addAttributeJoin (string $attributeCode, [string $joinType = 'inner'])
  • string $attributeCode
  • string $joinType: inner|left
_afterLoad (line 1289)
  • access: protected
void _afterLoad ()

Redefined in descendants as:
_beforeLoad (line 1284)
  • access: protected
void _beforeLoad ()

Redefined in descendants as:
_construct (line 116)

Initialize collection

  • access: protected
void _construct ()

Redefined in descendants as:
_getAllIdsSelect (line 818)

Clone and reset collection

  • access: protected
Mage_Eav_Model_Entity_Collection_Abstract _getAllIdsSelect ([ $limit = null], [ $offset = null])
  • $limit
  • $offset

Redefined in descendants as:
_getAttributeConditionSql (line 1221)

Get condition sql for the attribute

  • see: self::_getConditionSql
  • access: protected
string _getAttributeConditionSql (string $attribute, mixed $condition, [string $joinType = 'inner'])
  • string $attribute
  • mixed $condition
  • string $joinType
_getAttributeFieldName (line 1084)
  • access: protected
void _getAttributeFieldName ( $attributeCode)
  • $attributeCode

Redefined in descendants as:
_getAttributeTableAlias (line 1079)

Get alias for attribute value table

  • access: protected
string _getAttributeTableAlias (string $attributeCode)
  • string $attributeCode
_getLoadAttributesSelect (line 1027)

Retrieve attributes load select

  • access: protected
Mage_Eav_Model_Entity_Collection_Abstract _getLoadAttributesSelect (string $table, [ $attributeIds = array()])
  • string $table
  • $attributeIds

Redefined in descendants as:
_init (line 154)

Standard resource collection initalization

  • access: protected
Mage_Core_Model_Mysql4_Collection_Abstract _init (string $model, [ $entityModel = null])
  • string $model
  • $entityModel

Redefined in descendants as:
_initSelect (line 139)
  • access: protected
void _initSelect ()

Redefined in descendants as:
_joinAttributeToSelect (line 1202)

Adding join statement to collection select instance

  • access: protected
Mage_Eav_Model_Entity_Collection_Abstract _joinAttributeToSelect (string $method, object $attribute, string $tableAlias, array $condition, string $fieldCode, string $fieldAlias)
  • string $method
  • object $attribute
  • string $tableAlias
  • array $condition
  • string $fieldCode
  • string $fieldAlias

Redefined in descendants as:
_loadAttributes (line 980)

Load attributes into loaded entities

  • access: public
Mage_Eav_Model_Entity_Collection_Abstract _loadAttributes ([ $printQuery = false], [ $logQuery = false])
  • $printQuery
  • $logQuery

Redefined in descendants as:
_loadEntities (line 942)

Load entities records into items

  • access: public
Mage_Eav_Model_Entity_Collection_Abstract _loadEntities ([ $printQuery = false], [ $logQuery = false])
  • $printQuery
  • $logQuery
_prepareStaticFields (line 131)

Prepare static entity fields

  • access: protected

Redefined in descendants as:
_reset (line 1299)

Reset collection

  • access: protected
_setItemAttributeValue (line 1049)

Initialize entity ubject property value

$valueInfo is _getLoadAttributesSelect fetch result row

  • access: protected
Mage_Eav_Model_Entity_Collection_Abstract _setItemAttributeValue (array $valueInfo)
  • array $valueInfo

Documentation generated on Fri, 11 Feb 2011 16:54:54 +0200 by phpDocumentor 1.4.3