Mage_Rule_Model_Resource_Rule_Collection
extends Mage_Rule_Model_Resource_Rule_Collection_Abstract
in package
Abstract rules collection to be extended
since 1.7.0.0 use Mage_Rule_Model_Resource_Rule_Collection_Abstract instead
Table of Contents
Constants
- CACHE_TAG = 'COLLECTION_DATA'
- SORT_ORDER_ASC = 'ASC'
- SORT_ORDER_DESC = 'DESC'
Properties
- $_associatedEntitiesMap : array<string|int, mixed>
- Store associated with rule entities information map
- $_bindParams : array<string|int, mixed>
- List of binded variables for select
- $_cacheConf : array<string|int, mixed>
- Cache configuration array
- $_cacheKey : mixed
- $_cacheLifetime : mixed
- $_cacheTags : mixed
- $_conn : Zend_Db_Adapter_Abstract
- DB connection
- $_curPage : int|null
- Current page number for items pager
- $_data : array<string|int, mixed>|null
- All collection data array Used for getData method
- $_env : Mage_Rule_Model_Environment
- Quote rule environment
- $_eventObject : string
- Name of event parameter
- $_eventPrefix : string
- Name prefix of events that are dispatched by model
- $_fetchStmt : Zend_Db_Statement_Pdo
- Database's statement for fetch item one by one
- $_fieldsToSelect : array<string|int, mixed>|null
- Fields to select in query
- $_fieldsToSelectChanged : bool
- Fields to select changed flag
- $_filters : array<string|int, mixed>
- Filters configuration
- $_flags : array<string|int, mixed>
- Additional collection flags
- $_idFieldName : string
- Identifier fild name for collection items
- $_initialFieldsToSelect : array<string|int, mixed>|null
- Fields initial fields to select like id_field
- $_isCollectionLoaded : bool
- Loading state flag
- $_isFiltersRendered : bool
- Filter rendered flag
- $_isOrdersRendered : bool
- Whether orders are rendered
- $_itemObjectClass : string
- Item object class name
- $_items : array<string|int, mixed>
- Collection items
- $_joinedTables : array<string|int, mixed>
- Store joined tables here
- $_mainTable : string
- Collection main table
- $_map : array<string|int, mixed>|null
- Fields map for correlation names & real selected fields
- $_model : string
- Model name
- $_orders : array<string|int, mixed>
- Order configuration
- $_pageSize : int|false|null
- Pager page size
- $_resetItemsDataChanged : bool
- Reset items data changed flag
- $_resource : Mage_Core_Model_Resource_Db_Abstract
- Resource instance
- $_resourceModel : string
- Resource model name
- $_select : Varien_Db_Select
- Select oblect
- $_totalRecords : int|null
- Total items number
- $_useAnalyticFunction : bool
- Use analytic function flag If true - allows to prepare final select with analytic function
Methods
- __clone() : void
- Magic clone function
- __construct() : mixed
- Collection constructor
- addBindParam() : $this
- Add variable to bind list
- addExpressionFieldToSelect() : $this
- Add attribute expression (SUM, COUNT, etc) Example: ('sub_total', 'SUM({{attribute}})', array('attribute' => 'revenue')) Example: ('sub_total', 'SUM({{revenue}})', 'revenue') For some functions like SUM use groupByAttribute.
- addFieldToFilter() : Mage_Rule_Model_Resource_Rule_Collection_Abstract
- Provide support for website id filter
- addFieldToSelect() : $this
- Add field to select
- addFilter() : $this
- Add collection filter
- addFilterToMap() : $this
- Add filter to Map
- addIsActiveFilter() : Mage_Rule_Model_Resource_Rule_Collection_Abstract
- Filter collection to only active or inactive rules
- addItem() : $this
- Adding item to item array
- addOrder() : $this
- self::setOrder() alias
- addWebsiteFilter() : Mage_Rule_Model_Resource_Rule_Collection_Abstract
- Limit rules collection by specific websites
- addWebsitesToResult() : Mage_Rule_Model_Resource_Rule_Collection_Abstract
- Init flag for adding rule website ids to collection result
- clear() : $this
- Clear collection
- count() : int
- Retrieve count of collection loaded items
- distinct() : $this
- Set select distinct
- each() : mixed
- fetchItem() : Varien_Object|bool
- Returns a collection item that corresponds to the fetched row and moves the internal data pointer ahead
- formatDate() : string
- Format Date to internal database date format
- getAllIds() : array<string|int, mixed>
- Retrieve all ids for collection
- getCacheKey() : string
- getCacheLifetime() : int
- getCacheTags() : array<string|int, mixed>
- getColumnValues() : array<string|int, mixed>
- Retrieve field values from all items
- getConnection() : Varien_Db_Adapter_Interface
- Retrieve connection object
- getCurPage() : int
- Get current collection page
- getData() : array<string|int, mixed>
- Get all data array for collection
- getEnv() : Mage_Rule_Model_Environment
- Retrieve environment for the rules in collection
- getFilter() : Varien_Object|array<string|int, mixed>|null
- Search for a filter by specified field
- getFirstItem() : Varien_Object
- Retrieve collection first item
- getFlag() : mixed
- Retrieve Flag
- getIdFieldName() : string
- Id field name getter
- getItemByColumnValue() : Varien_Object|null
- Search first item by field value
- getItemById() : Varien_Object|null
- Retrieve item by id
- getItems() : array<string|int, mixed>
- Retrieve collection items
- getItemsByColumnValue() : array<string|int, mixed>
- Search all items by field value
- getIterator() : mixed
- Implementation of IteratorAggregate::getIterator()
- getLastItem() : Varien_Object
- Retrieve collection last item
- getLastPageNumber() : int
- Retrieve collection last page number
- getMainTable() : string
- Retrieve main table
- getModelName() : string
- Get model instance
- getNewEmptyItem() : Varien_Object
- Retrieve collection empty item
- getPageSize() : int
- Retrieve collection page size
- getResource() : Mage_Core_Model_Resource_Db_Abstract
- Get resource instance
- getResourceModelName() : string
- Retrieve resource model name
- getSelect() : Varien_Db_Select
- Get Zend_Db_Select instance and applies fields to select if needed
- getSelectCountSql() : Varien_Db_Select
- Get SQL for get record count
- getSelectSql() : string|Zend_Db_Select
- Get sql select string or object
- getSize() : int
- Get collection size
- getTable() : string
- Retrieve table name
- hasFlag() : bool
- Has Flag
- initCache() : $this
- Initialize collection cache
- isLoaded() : bool
- Retrieve collection loading status
- join() : $this
- Join table to collection select
- load() : $this
- Load data
- loadData() : $this
- Load data
- printLogQuery() : $this
- Print and/or log query
- process() : Mage_Rule_Model_Resource_Rule_Collection_Abstract
- Process the quote with all the rules in collection
- removeAllFieldsFromSelect() : $this
- Removes all fields from select
- removeFieldFromSelect() : $this
- Removes field from select
- removeItemByKey() : $this
- Remove item from collection by item key
- resetData() : $this
- Reset loaded for collection data array
- resetItemsDataChanged() : $this
- Set flag data has changed to all collection items
- save() : $this
- Save all the entities in the collection
- setActiveFilter() : Mage_Rule_Model_Resource_Rule_Collection_Abstract
- Set filter for the collection based on the environment
- setCacheKey() : $this
- setCacheTags() : $this
- setConnection() : $this
- Set database connection adapter
- setCurPage() : $this
- Set current page
- setDataToAll() : $this
- Setting data for all collection items
- setEnv() : $this
- Set environment for all rules in collection
- setFlag() : $this
- Set Flag
- setItemObjectClass() : $this
- Set collection item class name
- setMainTable() : $this
- Set main collection table
- setModel() : $this
- Set model name for collection items
- setOrder() : $this
- Add select order
- setPageSize() : $this
- Set collection page size
- setResetItemsDataChanged() : $this
- Set reset items data changed flag
- setResourceModel() : mixed
- Set resource model name for collection items
- toArray() : array<string|int, mixed>
- Convert collection to array
- toOptionArray() : array<string|int, mixed>
- toOptionHash() : array<string|int, mixed>
- toXml() : string
- Convert collection to XML
- unshiftOrder() : $this
- Add select order to the beginning
- walk() : array<string|int, mixed>
- Walk through the collection and run model method or external callback with optional arguments
- _addItem() : $this
- Add item that has no id to collection
- _afterLoad() : Mage_Rule_Model_Resource_Rule_Collection_Abstract
- Add website ids to rules data
- _afterLoadData() : $this
- Process loaded collection data
- _beforeLoad() : $this
- Redeclare before load method for adding event
- _canUseCache() : bool
- Check if cache can be used for collection
- _construct() : void
- Initialization here
- _fetchAll() : array<string|int, mixed>
- Fetch collection data
- _getAssociatedEntityInfo() : array<string|int, mixed>
- Retrieve correspondent entity information (associations table name, columns names) of rule's associated entity by specified entity type
- _getCacheTags() : array<string|int, mixed>
- Redeclared for processing cache tags throw application object
- _getConditionFieldName() : string
- _getConditionSql() : string
- Build SQL statement for condition
- _getInitialFieldsToSelect() : array<string|int, mixed>
- Retrieve initial fields to select like id field
- _getItemId() : mixed
- Get collection item identifier
- _getMappedField() : string
- Try to get mapped field name for filter to collection
- _getMapper() : array<string|int, mixed>|bool|null
- Retrieve mapper data
- _getSelectCacheId() : string
- Get cache identifier base on select
- _init() : $this
- Standard resource collection initialization
- _initInitialFieldsToSelect() : $this
- Initialize initial fields to select like id field
- _initSelect() : $this
- Init collection select
- _initSelectFields() : $this
- Init fields for select
- _loadCache() : string|false
- Load cached data for select
- _prepareSelect() : string
- Prepare select for load
- _renderFilters() : $this
- Render sql select conditions
- _renderFiltersBefore() : mixed
- Hook for operations before rendering filters
- _renderLimit() : $this
- Render sql select limit
- _renderOrders() : $this
- Render sql select orders
- _reset() : $this
- Reset collection
- _saveCache() : $this
- Save collection data to cache
- _setIdFieldName() : $this
- Specify collection objects id field name
- _setIsLoaded() : $this
- Set collection loading status flag
- _toOptionArray() : array<string|int, mixed>
- Convert items array to array for select options
- _toOptionHash() : array<string|int, mixed>
- Convert items array to hash for select options
- _toOptionHashOptimized() : array<string|int, mixed>
- Convert items array to hash for select options unsing fetchItem method
- _translateCondition() : string
- Build sql where condition part
- getCache() : Mage_Core_Model_Cache|null
Constants
CACHE_TAG
public
mixed
CACHE_TAG
= 'COLLECTION_DATA'
SORT_ORDER_ASC
public
mixed
SORT_ORDER_ASC
= 'ASC'
SORT_ORDER_DESC
public
mixed
SORT_ORDER_DESC
= 'DESC'
Properties
$_associatedEntitiesMap
Store associated with rule entities information map
protected
array<string|int, mixed>
$_associatedEntitiesMap
= []
Example: array( 'entity_type1' => array( 'associations_table' => 'table_name', 'rule_id_field' => 'rule_id', 'entity_id_field' => 'entity_id' ), 'entity_type2' => array( 'associations_table' => 'table_name', 'rule_id_field' => 'rule_id', 'entity_id_field' => 'entity_id' ) .... )
$_bindParams
List of binded variables for select
protected
array<string|int, mixed>
$_bindParams
= []
$_cacheConf
Cache configuration array
protected
array<string|int, mixed>
$_cacheConf
= \null
$_cacheKey
protected
mixed
$_cacheKey
$_cacheLifetime
protected
mixed
$_cacheLifetime
= 86400
$_cacheTags
protected
mixed
$_cacheTags
= []
$_conn
DB connection
protected
Zend_Db_Adapter_Abstract
$_conn
$_curPage
Current page number for items pager
protected
int|null
$_curPage
= 1
$_data
All collection data array Used for getData method
protected
array<string|int, mixed>|null
$_data
= \null
$_env
Quote rule environment
after 1.6.1.0
protected
Mage_Rule_Model_Environment
$_env
$_eventObject
Name of event parameter
protected
string
$_eventObject
= ''
$_eventPrefix
Name prefix of events that are dispatched by model
protected
string
$_eventPrefix
= ''
$_fetchStmt
Database's statement for fetch item one by one
protected
Zend_Db_Statement_Pdo
$_fetchStmt
= \null
$_fieldsToSelect
Fields to select in query
protected
array<string|int, mixed>|null
$_fieldsToSelect
= \null
$_fieldsToSelectChanged
Fields to select changed flag
protected
bool
$_fieldsToSelectChanged
= \false
$_filters
Filters configuration
protected
array<string|int, mixed>
$_filters
= []
$_flags
Additional collection flags
protected
array<string|int, mixed>
$_flags
= []
$_idFieldName
Identifier fild name for collection items
protected
string
$_idFieldName
Can be used by collections with items without defined
$_initialFieldsToSelect
Fields initial fields to select like id_field
protected
array<string|int, mixed>|null
$_initialFieldsToSelect
= \null
$_isCollectionLoaded
Loading state flag
protected
bool
$_isCollectionLoaded
$_isFiltersRendered
Filter rendered flag
protected
bool
$_isFiltersRendered
= \false
$_isOrdersRendered
Whether orders are rendered
protected
bool
$_isOrdersRendered
= \false
$_itemObjectClass
Item object class name
protected
string
$_itemObjectClass
= 'Varien_Object'
$_items
Collection items
protected
array<string|int, mixed>
$_items
= []
$_joinedTables
Store joined tables here
protected
array<string|int, mixed>
$_joinedTables
= []
$_mainTable
Collection main table
protected
string
$_mainTable
= \null
$_map
Fields map for correlation names & real selected fields
protected
array<string|int, mixed>|null
$_map
= \null
$_model
Model name
protected
string
$_model
$_orders
Order configuration
protected
array<string|int, mixed>
$_orders
= []
$_pageSize
Pager page size
protected
int|false|null
$_pageSize
= \false
if page size is false, then we works with all items
$_resetItemsDataChanged
Reset items data changed flag
protected
bool
$_resetItemsDataChanged
= \false
$_resource
Resource instance
protected
Mage_Core_Model_Resource_Db_Abstract
$_resource
$_resourceModel
Resource model name
protected
string
$_resourceModel
$_select
Select oblect
protected
Varien_Db_Select
$_select
$_totalRecords
Total items number
protected
int|null
$_totalRecords
$_useAnalyticFunction
Use analytic function flag If true - allows to prepare final select with analytic function
protected
bool
$_useAnalyticFunction
= \false
Methods
__clone()
Magic clone function
public
__clone() : void
Clone also Zend_Db_Select
__construct()
Collection constructor
public
__construct([Mage_Core_Model_Resource_Db_Abstract $resource = null ]) : mixed
Parameters
- $resource : Mage_Core_Model_Resource_Db_Abstract = null
addBindParam()
Add variable to bind list
public
addBindParam(string $name, mixed $value) : $this
Parameters
- $name : string
- $value : mixed
Return values
$thisaddExpressionFieldToSelect()
Add attribute expression (SUM, COUNT, etc) Example: ('sub_total', 'SUM({{attribute}})', array('attribute' => 'revenue')) Example: ('sub_total', 'SUM({{revenue}})', 'revenue') For some functions like SUM use groupByAttribute.
public
addExpressionFieldToSelect(string $alias, string $expression, array<string|int, mixed>|string $fields) : $this
Parameters
- $alias : string
- $expression : string
- $fields : array<string|int, mixed>|string
Return values
$thisaddFieldToFilter()
Provide support for website id filter
public
addFieldToFilter(string $field[, mixed $condition = null ]) : Mage_Rule_Model_Resource_Rule_Collection_Abstract
Parameters
- $field : string
- $condition : mixed = null
Attributes
- #[Override]
Return values
Mage_Rule_Model_Resource_Rule_Collection_AbstractaddFieldToSelect()
Add field to select
public
addFieldToSelect(string|array<string|int, mixed> $field[, string|null $alias = null ]) : $this
Parameters
- $field : string|array<string|int, mixed>
- $alias : string|null = null
Return values
$thisaddFilter()
Add collection filter
public
addFilter(string $field, string|array<string|int, mixed> $value[, string $type = 'and' ]) : $this
Parameters
- $field : string
- $value : string|array<string|int, mixed>
- $type : string = 'and'
-
and|or|string
Return values
$thisaddFilterToMap()
Add filter to Map
public
addFilterToMap(string $filter, string $alias[, string $group = 'fields' ]) : $this
Parameters
- $filter : string
- $alias : string
- $group : string = 'fields'
-
default 'fields'
Return values
$thisaddIsActiveFilter()
Filter collection to only active or inactive rules
public
addIsActiveFilter([int $isActive = 1 ]) : Mage_Rule_Model_Resource_Rule_Collection_Abstract
Parameters
- $isActive : int = 1
Return values
Mage_Rule_Model_Resource_Rule_Collection_AbstractaddItem()
Adding item to item array
public
addItem(Varien_Object $item) : $this
Parameters
- $item : Varien_Object
Return values
$thisaddOrder()
self::setOrder() alias
public
addOrder(string $field[, string $direction = self::SORT_ORDER_DESC ]) : $this
Parameters
- $field : string
- $direction : string = self::SORT_ORDER_DESC
Return values
$thisaddWebsiteFilter()
Limit rules collection by specific websites
public
addWebsiteFilter(int|array<string|int, mixed>|Mage_Core_Model_Website $websiteId) : Mage_Rule_Model_Resource_Rule_Collection_Abstract
Parameters
- $websiteId : int|array<string|int, mixed>|Mage_Core_Model_Website
Return values
Mage_Rule_Model_Resource_Rule_Collection_AbstractaddWebsitesToResult()
Init flag for adding rule website ids to collection result
public
addWebsitesToResult([bool|null $flag = null ]) : Mage_Rule_Model_Resource_Rule_Collection_Abstract
Parameters
- $flag : bool|null = null
Return values
Mage_Rule_Model_Resource_Rule_Collection_Abstractclear()
Clear collection
public
clear() : $this
Return values
$thiscount()
Retrieve count of collection loaded items
public
count() : int
Attributes
- #[Override]
- #[ReturnTypeWillChange]
Return values
intdistinct()
Set select distinct
public
distinct(bool $flag) : $this
Parameters
- $flag : bool
Attributes
- #[Override]
Return values
$thiseach()
public
each(callable $obj_method[, array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $obj_method : callable
- $args : array<string|int, mixed> = []
fetchItem()
Returns a collection item that corresponds to the fetched row and moves the internal data pointer ahead
public
fetchItem() : Varien_Object|bool
Return values
Varien_Object|boolformatDate()
Format Date to internal database date format
public
formatDate(int|string|Zend_Date $date[, bool $includeTime = true ]) : string
Parameters
- $date : int|string|Zend_Date
- $includeTime : bool = true
Return values
stringgetAllIds()
Retrieve all ids for collection
public
getAllIds() : array<string|int, mixed>
Attributes
- #[Override]
Return values
array<string|int, mixed>getCacheKey()
public
getCacheKey() : string
Return values
stringgetCacheLifetime()
public
getCacheLifetime() : int
Return values
intgetCacheTags()
public
getCacheTags() : array<string|int, mixed>
Return values
array<string|int, mixed>getColumnValues()
Retrieve field values from all items
public
getColumnValues(string $colName) : array<string|int, mixed>
Parameters
- $colName : string
Return values
array<string|int, mixed>getConnection()
Retrieve connection object
public
getConnection() : Varien_Db_Adapter_Interface
Return values
Varien_Db_Adapter_InterfacegetCurPage()
Get current collection page
public
getCurPage([int $displacement = 0 ]) : int
Parameters
- $displacement : int = 0
Return values
intgetData()
Get all data array for collection
public
getData() : array<string|int, mixed>
Attributes
- #[Override]
Return values
array<string|int, mixed>getEnv()
Retrieve environment for the rules in collection
public
getEnv() : Mage_Rule_Model_Environment
after 1.6.2.0
Return values
Mage_Rule_Model_EnvironmentgetFilter()
Search for a filter by specified field
public
getFilter(string|array<string|int, mixed> $field) : Varien_Object|array<string|int, mixed>|null
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
Parameters
- $field : string|array<string|int, mixed>
Return values
Varien_Object|array<string|int, mixed>|nullgetFirstItem()
Retrieve collection first item
public
getFirstItem() : Varien_Object
Return values
Varien_ObjectgetFlag()
Retrieve Flag
public
getFlag(string $flag) : mixed
Parameters
- $flag : string
getIdFieldName()
Id field name getter
public
getIdFieldName() : string
Return values
stringgetItemByColumnValue()
Search first item by field value
public
getItemByColumnValue(string $column, mixed $value) : Varien_Object|null
Parameters
- $column : string
- $value : mixed
Return values
Varien_Object|nullgetItemById()
Retrieve item by id
public
getItemById(mixed $idValue) : Varien_Object|null
Parameters
- $idValue : mixed
Return values
Varien_Object|nullgetItems()
Retrieve collection items
public
getItems() : array<string|int, mixed>
Return values
array<string|int, mixed>getItemsByColumnValue()
Search all items by field value
public
getItemsByColumnValue(string $column, mixed $value) : array<string|int, mixed>
Parameters
- $column : string
- $value : mixed
Return values
array<string|int, mixed>getIterator()
Implementation of IteratorAggregate::getIterator()
public
getIterator() : mixed
Attributes
- #[Override]
- #[ReturnTypeWillChange]
getLastItem()
Retrieve collection last item
public
getLastItem() : Varien_Object
Return values
Varien_ObjectgetLastPageNumber()
Retrieve collection last page number
public
getLastPageNumber() : int
Return values
intgetMainTable()
Retrieve main table
public
getMainTable() : string
Return values
stringgetModelName()
Get model instance
public
getModelName([array<string|int, mixed> $args = [] ]) : string
Parameters
- $args : array<string|int, mixed> = []
Return values
stringgetNewEmptyItem()
Retrieve collection empty item
public
getNewEmptyItem() : Varien_Object
Return values
Varien_ObjectgetPageSize()
Retrieve collection page size
public
getPageSize() : int
Return values
intgetResource()
Get resource instance
public
getResource() : Mage_Core_Model_Resource_Db_Abstract
Return values
Mage_Core_Model_Resource_Db_AbstractgetResourceModelName()
Retrieve resource model name
public
getResourceModelName() : string
Return values
stringgetSelect()
Get Zend_Db_Select instance and applies fields to select if needed
public
getSelect() : Varien_Db_Select
Attributes
- #[Override]
Return values
Varien_Db_SelectgetSelectCountSql()
Get SQL for get record count
public
getSelectCountSql() : Varien_Db_Select
Return values
Varien_Db_SelectgetSelectSql()
Get sql select string or object
public
getSelectSql([bool $stringMode = false ]) : string|Zend_Db_Select
Parameters
- $stringMode : bool = false
Return values
string|Zend_Db_SelectgetSize()
Get collection size
public
getSize() : int
Attributes
- #[Override]
Return values
intgetTable()
Retrieve table name
public
getTable(string $table) : string
Parameters
- $table : string
Return values
stringhasFlag()
Has Flag
public
hasFlag(string $flag) : bool
Parameters
- $flag : string
Return values
boolinitCache()
Initialize collection cache
public
initCache(mixed $object, string $idPrefix, array<string|int, mixed> $tags) : $this
Parameters
- $object : mixed
- $idPrefix : string
- $tags : array<string|int, mixed>
Return values
$thisisLoaded()
Retrieve collection loading status
public
isLoaded() : bool
Return values
booljoin()
Join table to collection select
public
join(array<string|int, mixed>|string|Zend_Db_Expr $table, string $cond[, array<string|int, mixed>|string $cols = '*' ]) : $this
Parameters
- $table : array<string|int, mixed>|string|Zend_Db_Expr
-
Table name
- $cond : string
-
Join on this condition
- $cols : array<string|int, mixed>|string = '*'
-
The columns to select from the joined table
Return values
$thisload()
Load data
public
load([bool $printQuery = false ][, bool $logQuery = false ]) : $this
Parameters
- $printQuery : bool = false
- $logQuery : bool = false
Attributes
- #[Override]
Return values
$thisloadData()
Load data
public
loadData([bool $printQuery = false ][, bool $logQuery = false ]) : $this
Parameters
- $printQuery : bool = false
- $logQuery : bool = false
Attributes
- #[Override]
Return values
$thisprintLogQuery()
Print and/or log query
public
printLogQuery([bool $printQuery = false ][, bool $logQuery = false ][, string $sql = null ]) : $this
Parameters
- $printQuery : bool = false
- $logQuery : bool = false
- $sql : string = null
Return values
$thisprocess()
Process the quote with all the rules in collection
public
process() : Mage_Rule_Model_Resource_Rule_Collection_Abstract
after 1.6.2.0
Return values
Mage_Rule_Model_Resource_Rule_Collection_AbstractremoveAllFieldsFromSelect()
Removes all fields from select
public
removeAllFieldsFromSelect() : $this
Return values
$thisremoveFieldFromSelect()
Removes field from select
public
removeFieldFromSelect(string|null $field[, bool $isAlias = false ]) : $this
Parameters
- $field : string|null
- $isAlias : bool = false
-
Alias identifier
Return values
$thisremoveItemByKey()
Remove item from collection by item key
public
removeItemByKey(mixed $key) : $this
Parameters
- $key : mixed
Return values
$thisresetData()
Reset loaded for collection data array
public
resetData() : $this
Return values
$thisresetItemsDataChanged()
Set flag data has changed to all collection items
public
resetItemsDataChanged() : $this
Return values
$thissave()
Save all the entities in the collection
public
save() : $this
Return values
$thissetActiveFilter()
Set filter for the collection based on the environment
public
setActiveFilter() : Mage_Rule_Model_Resource_Rule_Collection_Abstract
after 1.6.2.0
Return values
Mage_Rule_Model_Resource_Rule_Collection_AbstractsetCacheKey()
public
setCacheKey(string $key) : $this
Parameters
- $key : string
Return values
$thissetCacheTags()
public
setCacheTags(array<string|int, mixed> $tags) : $this
Parameters
- $tags : array<string|int, mixed>
Return values
$thissetConnection()
Set database connection adapter
public
setConnection(Varien_Db_Adapter_Interface|Zend_Db_Adapter_Abstract $conn) : $this
Parameters
- $conn : Varien_Db_Adapter_Interface|Zend_Db_Adapter_Abstract
Return values
$thissetCurPage()
Set current page
public
setCurPage(int|null $page) : $this
Parameters
- $page : int|null
Return values
$thissetDataToAll()
Setting data for all collection items
public
setDataToAll(mixed $key[, mixed $value = null ]) : $this
Parameters
- $key : mixed
- $value : mixed = null
Return values
$thissetEnv()
Set environment for all rules in collection
public
setEnv([Mage_Rule_Model_Environment|null $env = null ]) : $this
after 1.6.2.0
Parameters
- $env : Mage_Rule_Model_Environment|null = null
Return values
$thissetFlag()
Set Flag
public
setFlag(string $flag[, mixed $value = null ]) : $this
Parameters
- $flag : string
- $value : mixed = null
Return values
$thissetItemObjectClass()
Set collection item class name
public
setItemObjectClass(string $className) : $this
Parameters
- $className : string
Return values
$thissetMainTable()
Set main collection table
public
setMainTable(string $table) : $this
Parameters
- $table : string
Return values
$thissetModel()
Set model name for collection items
public
setModel(string $model) : $this
Parameters
- $model : string
Return values
$thissetOrder()
Add select order
public
setOrder(string $field[, string $direction = self::SORT_ORDER_DESC ]) : $this
Parameters
- $field : string
- $direction : string = self::SORT_ORDER_DESC
Attributes
- #[Override]
Return values
$thissetPageSize()
Set collection page size
public
setPageSize(int|null $size) : $this
Parameters
- $size : int|null
Return values
$thissetResetItemsDataChanged()
Set reset items data changed flag
public
setResetItemsDataChanged(bool $flag) : $this
Parameters
- $flag : bool
Return values
$thissetResourceModel()
Set resource model name for collection items
public
setResourceModel(string $model) : mixed
Parameters
- $model : string
toArray()
Convert collection to array
public
toArray([array<string|int, mixed> $arrRequiredFields = [] ]) : array<string|int, mixed>
Parameters
- $arrRequiredFields : array<string|int, mixed> = []
Return values
array<string|int, mixed>toOptionArray()
public
toOptionArray() : array<string|int, mixed>
Return values
array<string|int, mixed>toOptionHash()
public
toOptionHash() : array<string|int, mixed>
Return values
array<string|int, mixed>toXml()
Convert collection to XML
public
toXml() : string
Return values
stringunshiftOrder()
Add select order to the beginning
public
unshiftOrder(string $field[, string $direction = self::SORT_ORDER_DESC ]) : $this
Parameters
- $field : string
- $direction : string = self::SORT_ORDER_DESC
Return values
$thiswalk()
Walk through the collection and run model method or external callback with optional arguments
public
walk(string|callable $callback[, array<string|int, mixed> $args = [] ]) : array<string|int, mixed>
Returns array with results of callback for each item
Parameters
- $callback : string|callable
- $args : array<string|int, mixed> = []
Return values
array<string|int, mixed>_addItem()
Add item that has no id to collection
protected
_addItem(Varien_Object $item) : $this
Parameters
- $item : Varien_Object
Return values
$this_afterLoad()
Add website ids to rules data
protected
_afterLoad() : Mage_Rule_Model_Resource_Rule_Collection_Abstract
Attributes
- #[Override]
Return values
Mage_Rule_Model_Resource_Rule_Collection_Abstract_afterLoadData()
Process loaded collection data
protected
_afterLoadData() : $this
Return values
$this_beforeLoad()
Redeclare before load method for adding event
protected
_beforeLoad() : $this
Attributes
- #[Override]
Return values
$this_canUseCache()
Check if cache can be used for collection
protected
_canUseCache() : bool
Attributes
- #[Override]
Return values
bool_construct()
Initialization here
protected
_construct() : void
_fetchAll()
Fetch collection data
protected
_fetchAll(Zend_Db_Select|string $select) : array<string|int, mixed>
Parameters
- $select : Zend_Db_Select|string
Return values
array<string|int, mixed>_getAssociatedEntityInfo()
Retrieve correspondent entity information (associations table name, columns names) of rule's associated entity by specified entity type
protected
_getAssociatedEntityInfo(string $entityType) : array<string|int, mixed>
Parameters
- $entityType : string
Return values
array<string|int, mixed>_getCacheTags()
Redeclared for processing cache tags throw application object
protected
_getCacheTags() : array<string|int, mixed>
Attributes
- #[Override]
Return values
array<string|int, mixed>_getConditionFieldName()
protected
_getConditionFieldName(string $fieldName) : string
Parameters
- $fieldName : string
Return values
string_getConditionSql()
Build SQL statement for condition
protected
_getConditionSql(string $fieldName, int|string|array<string|int, mixed> $condition) : string
If $condition integer or string - exact value will be filtered ('eq' condition)
If $condition is array - one of the following structures is expected:
- array("from" => $fromValue, "to" => $toValue)
- array("eq" => $equalValue)
- array("neq" => $notEqualValue)
- array("like" => $likeValue)
- array("in" => array($inValues))
- array("nin" => array($notInValues))
- array("notnull" => $valueIsNotNull)
- array("null" => $valueIsNull)
- array("moreq" => $moreOrEqualValue)
- array("gt" => $greaterValue)
- array("lt" => $lessValue)
- array("gteq" => $greaterOrEqualValue)
- array("lteq" => $lessOrEqualValue)
- array("finset" => $valueInSet)
- array("regexp" => $regularExpression)
- array("seq" => $stringValue)
- array("sneq" => $stringValue)
If non matched - sequential array is expected and OR conditions will be built using above mentioned structure
Parameters
- $fieldName : string
-
Field name must be already escaped with Varien_Db_Adapter_Interface::quoteIdentifier()
- $condition : int|string|array<string|int, mixed>
Return values
string_getInitialFieldsToSelect()
Retrieve initial fields to select like id field
protected
_getInitialFieldsToSelect() : array<string|int, mixed>
Return values
array<string|int, mixed>_getItemId()
Get collection item identifier
protected
_getItemId(Varien_Object $item) : mixed
Parameters
- $item : Varien_Object
Attributes
- #[Override]
_getMappedField()
Try to get mapped field name for filter to collection
protected
_getMappedField(string $field) : string
Parameters
- $field : string
Return values
string_getMapper()
Retrieve mapper data
protected
_getMapper() : array<string|int, mixed>|bool|null
Return values
array<string|int, mixed>|bool|null_getSelectCacheId()
Get cache identifier base on select
protected
_getSelectCacheId(Zend_Db_Select|string $select) : string
Parameters
- $select : Zend_Db_Select|string
Return values
string_init()
Standard resource collection initialization
protected
_init(string $model[, Mage_Core_Model_Resource_Db_Abstract $resourceModel = null ]) : $this
Parameters
- $model : string
- $resourceModel : Mage_Core_Model_Resource_Db_Abstract = null
Return values
$this_initInitialFieldsToSelect()
Initialize initial fields to select like id field
protected
_initInitialFieldsToSelect() : $this
Return values
$this_initSelect()
Init collection select
protected
_initSelect() : $this
Return values
$this_initSelectFields()
Init fields for select
protected
_initSelectFields() : $this
Return values
$this_loadCache()
Load cached data for select
protected
_loadCache(Zend_Db_Select $select) : string|false
Parameters
- $select : Zend_Db_Select
Attributes
- #[Override]
Return values
string|false_prepareSelect()
Prepare select for load
protected
_prepareSelect(Varien_Db_Select $select) : string
Parameters
- $select : Varien_Db_Select
Tags
Return values
string_renderFilters()
Render sql select conditions
protected
_renderFilters() : $this
Attributes
- #[Override]
Return values
$this_renderFiltersBefore()
Hook for operations before rendering filters
protected
_renderFiltersBefore() : mixed
_renderLimit()
Render sql select limit
protected
_renderLimit() : $this
Attributes
- #[Override]
Return values
$this_renderOrders()
Render sql select orders
protected
_renderOrders() : $this
Attributes
- #[Override]
Return values
$this_reset()
Reset collection
protected
_reset() : $this
Return values
$this_saveCache()
Save collection data to cache
protected
_saveCache(array<string|int, mixed> $data, Zend_Db_Select $select) : $this
Parameters
- $data : array<string|int, mixed>
- $select : Zend_Db_Select
Attributes
- #[Override]
Return values
$this_setIdFieldName()
Specify collection objects id field name
protected
_setIdFieldName(string $fieldName) : $this
Parameters
- $fieldName : string
Return values
$this_setIsLoaded()
Set collection loading status flag
protected
_setIsLoaded([bool $flag = true ]) : $this
Parameters
- $flag : bool = true
Return values
$this_toOptionArray()
Convert items array to array for select options
protected
_toOptionArray([string $valueField = 'id' ][, string $labelField = 'name' ][, array<string|int, mixed> $additional = [] ]) : array<string|int, mixed>
return items array array( $index => array( 'value' => mixed 'label' => mixed ) )
Parameters
- $valueField : string = 'id'
- $labelField : string = 'name'
- $additional : array<string|int, mixed> = []
Return values
array<string|int, mixed>_toOptionHash()
Convert items array to hash for select options
protected
_toOptionHash([string $valueField = 'id' ][, string $labelField = 'name' ]) : array<string|int, mixed>
return items hash array($value => $label)
Parameters
- $valueField : string = 'id'
- $labelField : string = 'name'
Return values
array<string|int, mixed>_toOptionHashOptimized()
Convert items array to hash for select options unsing fetchItem method
protected
_toOptionHashOptimized([string $valueField = 'id' ][, string $labelField = 'name' ]) : array<string|int, mixed>
The difference between _toOptionHash() and this one is that this method fetch items one by one and does not load all collection items at once return items hash array($value => $label)
Parameters
- $valueField : string = 'id'
- $labelField : string = 'name'
Tags
Return values
array<string|int, mixed>_translateCondition()
Build sql where condition part
protected
_translateCondition(string|array<string|int, mixed> $field, int|string|array<string|int, mixed> $condition) : string
Parameters
- $field : string|array<string|int, mixed>
- $condition : int|string|array<string|int, mixed>
Return values
stringgetCache()
protected
getCache() : Mage_Core_Model_Cache|null