Class Varien_Data_Collection

Description

Implements interfaces:

  • IteratorAggregate (internal interface)
  • Countable (internal interface)

Data collection

Located in /Data/Collection.php (line 34)


	
			
Direct descendents
Class Description
Varien_Directory_Collection Data collection
Varien_Data_Collection_Filesystem Filesystem items collection
Varien_Data_Collection_Db Base items collection class
Class Constant Summary
SORT_ORDER_ASC = 'ASC'
SORT_ORDER_DESC = 'DESC'
Variable Summary
Method Summary
Varien_Data_Collection __construct ()
void addFilter (string $field, string $value, [string $type = 'and'])
int count ()
void distinct (bool $flag)
void each ( $obj_method, [ $args = array()])
array getAllIds ()
void getCacheKey ()
void getCacheTags ()
array getColumnValues (string $colName)
int getCurPage ([int $displacement = 0])
Varien_Object|array|null getFilter (string|array $field)
mixed getFlag (string $flag)
Varien_Object getItemByColumnValue (string $column, mixed $value)
Varien_Object getItemById (mixed $idValue)
array getItems ()
array getItemsByColumnValue (string $column, mixed $value)
void getIterator ()
int getPageSize ()
int getSize ()
bool hasFlag (string $flag)
bool isLoaded ()
Varien_Data_Collection load ([ $printQuery = false], [ $logQuery = false])
Varien_Data_Collection loadData ([ $printQuery = false], [ $logQuery = false])
void setCacheKey ( $key)
void setCacheTags ( $tags)
Varien_Data_Collection setDataToAll (mixed $key, [mixed $value = null])
Varien_Data_Collection setFlag (string $flag, [mixed $value = null])
Varien_Data_Collection setOrder (string $field, [string $direction = self::SORT_ORDER_DESC])
array toArray ([ $arrRequiredFields = array()])
void toOptionArray ()
void toOptionHash ()
string toXml ()
array walk ( $callback, [ $args = array()], string $method)
mixed _getItemId ( $item)
unknown _setIsLoaded ([unknown_type $flag = true])
array _toOptionArray ([string $valueField = 'id'], [string $labelField = 'name'], [ $additional = array()])
array _toOptionHash ([string $valueField = 'id'], [string $labelField = 'name'])
Variables
mixed $_cacheKey (line 104)
  • access: protected
mixed $_cacheLifetime = 86400 (line 108)
  • access: protected
mixed $_cacheTags = array() (line 106)
  • access: protected
int $_curPage = 1 (line 79)

Current page number for items pager

  • access: protected
array $_filters = array() (line 65)

Filters configuration

  • access: protected

Redefined in descendants as:
array $_flags = array() (line 115)

Additional collection flags

  • access: protected
bool $_isCollectionLoaded (line 102)

Loading state flag

  • access: protected
bool $_isFiltersRendered = false (line 72)

Filter rendered flag

  • access: protected
string $_itemObjectClass = 'Varien_Object' (line 51)

Item object class name

  • access: protected
array $_items = array() (line 44)

Collection items

  • access: protected
array $_orders = array() (line 58)

Order configuration

  • access: protected
int $_pageSize = false (line 88)

Pager page size

if page size is false, then we works with all items

  • var: | false
  • access: protected
int $_totalRecords (line 95)

Total items number

  • access: protected
Methods
Constructor __construct (line 117)
  • access: public
Varien_Data_Collection __construct ()

Redefined in descendants as:
addFilter (line 129)

Add collection filter

  • access: public
void addFilter (string $field, string $value, [string $type = 'and'])
  • string $field
  • string $value
  • string $type: and|or|string

Redefined in descendants as:
addItem (line 367)

Adding item to item array

  • access: public
Varien_Data_Collection addItem ( $item)

Redefined in descendants as:
clear (line 426)

Clear collection

  • access: public
count (line 738)

Retireve count of collection loaded items

  • access: public
int count ()

Implementation of:
Countable::count
distinct (line 588)

Set select distinct

  • access: public
void distinct (bool $flag)
  • bool $flag

Redefined in descendants as:
each (line 459)
  • access: public
void each ( $obj_method, [ $args = array()])
  • $obj_method
  • $args
getAllIds (line 398)

Retrieve ids of all tems

  • access: public
array getAllIds ()

Redefined in descendants as:
getCacheKey (line 750)
  • access: public
void getCacheKey ()
getCacheLifetime (line 766)
  • access: public
void getCacheLifetime ()
getCacheTags (line 761)
  • access: public
void getCacheTags ()
getColumnValues (line 311)

Retrieve field values from all items

  • access: public
array getColumnValues (string $colName)
  • string $colName
getCurPage (line 206)

Get current collection page

  • access: public
int getCurPage ([int $displacement = 0])
  • int $displacement
getFilter (line 153)

Search for a filter by specified field

Multiple filters can be matched if an array is specified:

  • 'foo' -- get the first filter with field name 'foo'
  • array('foo') -- get all filters with field name 'foo'
  • array('foo', 'bar') -- get all filters with field name 'foo' or 'bar'
  • array() -- get all filters

  • access: public
Varien_Object|array|null getFilter (string|array $field)
  • string|array $field
getFirstItem (line 266)

Retrieve collection first item

  • access: public
Varien_Object getFirstItem ()
getFlag (line 777)

Retrieve Flag

  • access: public
mixed getFlag (string $flag)
  • string $flag
getItemByColumnValue (line 349)

Search first item by field value

  • return: || null
  • access: public
Varien_Object getItemByColumnValue (string $column, mixed $value)
  • string $column
  • mixed $value
getItemById (line 715)

Retrieve item by id

  • access: public
Varien_Object getItemById (mixed $idValue)
  • mixed $idValue
getItems (line 299)

Retrieve collection items

  • access: public
array getItems ()
getItemsByColumnValue (line 329)

Search all items by field value

  • access: public
array getItemsByColumnValue (string $column, mixed $value)
  • string $column
  • mixed $value
getIterator (line 727)

Implementation of IteratorAggregate::getIterator()

  • access: public
void getIterator ()

Implementation of:
IteratorAggregate::getIterator
getLastItem (line 283)

Retrieve collection last item

  • access: public
Varien_Object getLastItem ()
getLastPageNumber (line 223)

Retrieve collection last page number

  • access: public
int getLastPageNumber ()
getNewEmptyItem (line 548)

Retrieve collection empty item

  • access: public
Varien_Object getNewEmptyItem ()
getPageSize (line 242)

Retrieve collection page size

  • access: public
int getPageSize ()
getSize (line 252)

Retrieve collection all items count

  • access: public
int getSize ()

Redefined in descendants as:
hasFlag (line 801)

Has Flag

  • access: public
bool hasFlag (string $flag)
  • string $flag
isLoaded (line 183)

Retrieve collection loading status

  • access: public
bool isLoaded ()
load (line 608)

Load data

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

Redefined in descendants as:
loadData (line 598)

Load data

  • access: public
Varien_Data_Collection loadData ([ $printQuery = false], [ $logQuery = false])
  • $printQuery
  • $logQuery

Redefined in descendants as:
removeItemByKey (line 413)

Remove item from collection by item key

  • access: public
Varien_Data_Collection removeItemByKey (mixed $key)
  • mixed $key
setCacheKey (line 744)
  • access: public
void setCacheKey ( $key)
  • $key
setCacheTags (line 755)
  • access: public
void setCacheTags ( $tags)
  • $tags
setCurPage (line 493)

Set current page

  • access: public
Varien_Data_Collection setCurPage (int $page)
  • int $page
setDataToAll (line 473)

Setting data for all collection items

  • access: public
Varien_Data_Collection setDataToAll (mixed $key, [mixed $value = null])
  • mixed $key
  • mixed $value
setFlag (line 789)

Set Flag

  • access: public
Varien_Data_Collection setFlag (string $flag, [mixed $value = null])
  • string $flag
  • mixed $value
setItemObjectClass (line 530)

Set collection item class name

Varien_Data_Collection setItemObjectClass (string $className)
  • string $className
setOrder (line 518)

Set select order

  • access: public
Varien_Data_Collection setOrder (string $field, [string $direction = self::SORT_ORDER_DESC])
  • string $field
  • string $direction

Redefined in descendants as:
setPageSize (line 505)

Set collection page size

  • access: public
Varien_Data_Collection setPageSize (int $size)
  • int $size
toArray (line 638)

Convert collection to array

  • access: public
array toArray ([ $arrRequiredFields = array()])
  • $arrRequiredFields

Redefined in descendants as:
toOptionArray (line 680)
  • access: public
void toOptionArray ()
toOptionHash (line 685)
  • access: public
void toOptionHash ()
toXml (line 618)

Convert collection to XML

  • access: public
string toXml ()

Redefined in descendants as:
walk (line 443)

Walk through the collection and run model method or external callback with optional arguments

Returns array with results of callback for each item

  • access: public
array walk ( $callback, [ $args = array()], string $method)
  • string $method
  • array $args
  • $callback
_getItemId (line 388)

Retrieve item id

  • access: protected
mixed _getItemId ( $item)

Redefined in descendants as:
_renderFilters (line 558)

Render sql select conditions

  • access: protected
Varien_Data_Collection _renderFilters ()

Redefined in descendants as:
_renderLimit (line 578)

Render sql select limit

  • access: protected
Varien_Data_Collection _renderLimit ()

Redefined in descendants as:
_renderOrders (line 568)

Render sql select orders

  • access: protected
Varien_Data_Collection _renderOrders ()

Redefined in descendants as:
_setIsLoaded (line 194)

Set collection loading status flag

  • access: protected
unknown _setIsLoaded ([unknown_type $flag = true])
  • unknown_type $flag
_toOptionArray (line 665)

Convert items array to array for select options

return items array array( $index => array( 'value' => mixed 'label' => mixed ) )

  • access: protected
array _toOptionArray ([string $valueField = 'id'], [string $labelField = 'name'], [ $additional = array()])
  • string $valueField
  • string $labelField
  • $additional
_toOptionHash (line 700)

Convert items array to hash for select options

return items hash array($value => $label)

  • access: protected
array _toOptionHash ([string $valueField = 'id'], [string $labelField = 'name'])
  • string $valueField
  • string $labelField
Class Constants
SORT_ORDER_ASC = 'ASC' (line 36)
SORT_ORDER_DESC = 'DESC' (line 37)

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