Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Public Member Functions | |
__construct (EntityFactoryInterface $entityFactory, Logger $logger, FetchStrategyInterface $fetchStrategy, \Magento\Framework\DB\Adapter\AdapterInterface $connection=null) | |
getResource () | |
addBindParam ($name, $value) | |
getIdFieldName () | |
setConnection (\Magento\Framework\DB\Adapter\AdapterInterface $conn) | |
getSelect () | |
getConnection () | |
getSize () | |
getSelectCountSql () | |
getSelectSql ($stringMode=false) | |
setOrder ($field, $direction=self::SORT_ORDER_DESC) | |
addOrder ($field, $direction=self::SORT_ORDER_DESC) | |
unshiftOrder ($field, $direction=self::SORT_ORDER_DESC) | |
addFieldToFilter ($field, $condition=null) | |
distinct ($flag) | |
load ($printQuery=false, $logQuery=false) | |
loadWithFilter ($printQuery=false, $logQuery=false) | |
fetchItem () | |
getData () | |
resetData () | |
loadData ($printQuery=false, $logQuery=false) | |
printLogQuery ($printQuery=false, $logQuery=false, $sql=null) | |
addFilterToMap ($filter, $alias, $group='fields') | |
__clone () | |
joinExtensionAttribute (JoinDataInterface $join, JoinProcessorInterface $extensionAttributesJoinProcessor) | |
getItemObjectClass () | |
__sleep () | |
__wakeup () | |
![]() | |
__construct (EntityFactoryInterface $entityFactory) | |
addFilter ($field, $value, $type='and') | |
addFieldToFilter ($field, $condition) | |
getFilter ($field) | |
isLoaded () | |
getCurPage ($displacement=0) | |
getLastPageNumber () | |
getPageSize () | |
getSize () | |
getFirstItem () | |
getLastItem () | |
getItems () | |
getColumnValues ($colName) | |
getItemsByColumnValue ($column, $value) | |
getItemByColumnValue ($column, $value) | |
addItem (\Magento\Framework\DataObject $item) | |
getAllIds () | |
removeItemByKey ($key) | |
removeAllItems () | |
clear () | |
walk ($callback, array $args=[]) | |
each ($objMethod, $args=[]) | |
setDataToAll ($key, $value=null) | |
setCurPage ($page) | |
setPageSize ($size) | |
setOrder ($field, $direction=self::SORT_ORDER_DESC) | |
setItemObjectClass ($className) | |
getNewEmptyItem () | |
distinct ($flag) | |
loadData ($printQuery=false, $logQuery=false) | |
load ($printQuery=false, $logQuery=false) | |
loadWithFilter ($printQuery=false, $logQuery=false) | |
toXml () | |
toArray ($arrRequiredFields=[]) | |
toOptionArray () | |
toOptionHash () | |
getItemById ($idValue) | |
getIterator () | |
count () | |
getFlag ($flag) | |
setFlag ($flag, $value=null) | |
hasFlag ($flag) | |
__sleep () | |
__wakeup () | |
Protected Member Functions | |
_setIdFieldName ($fieldName) | |
_getItemId (\Magento\Framework\DataObject $item) | |
_renderFilters () | |
_renderFiltersBefore () | |
_translateCondition ($field, $condition) | |
_getMappedField ($field) | |
_getMapper () | |
_getConditionSql ($fieldName, $condition) | |
_getConditionFieldName ($fieldName) | |
_renderOrders () | |
_renderLimit () | |
_beforeLoad () | |
beforeAddLoadedItem (\Magento\Framework\DataObject $item) | |
_toOptionArray ($valueField=null, $labelField='name', $additional=[]) | |
_toOptionHash ($valueField=null, $labelField='name') | |
_afterLoadData () | |
_afterLoad () | |
_logQuery ($sql) | |
_reset () | |
_fetchAll (Select $select) | |
_initSelect () | |
![]() | |
_setIsLoaded ($flag=true) | |
_addItem ($item) | |
_getItemId (\Magento\Framework\DataObject $item) | |
_renderFilters () | |
_renderOrders () | |
_renderLimit () | |
_toOptionArray ($valueField='id', $labelField='name', $additional=[]) | |
_toOptionHash ($valueField='id', $labelField='name') | |
Protected Attributes | |
$_conn | |
$_select | |
$_idFieldName | |
$_bindParams = [] | |
$_data = null | |
$_map = null | |
$_fetchStmt = null | |
$_isOrdersRendered = false | |
$_logger | |
$extensionAttributesJoinProcessor | |
![]() | |
$_items = [] | |
$_itemObjectClass = \Magento\Framework\DataObject::class | |
$_orders = [] | |
$_filters = [] | |
$_isFiltersRendered = false | |
$_curPage = 1 | |
$_pageSize = false | |
$_totalRecords | |
$_isCollectionLoaded | |
$_flags = [] | |
$_entityFactory | |
Additional Inherited Members | |
![]() | |
const | SORT_ORDER_ASC = 'ASC' |
const | SORT_ORDER_DESC = 'DESC' |
Base items collection class
@api @SuppressWarnings(PHPMD.CouplingBetweenObjects)
Definition at line 23 of file AbstractDb.php.
__construct | ( | EntityFactoryInterface | $entityFactory, |
Logger | $logger, | ||
FetchStrategyInterface | $fetchStrategy, | ||
\Magento\Framework\DB\Adapter\AdapterInterface | $connection = null |
||
) |
EntityFactoryInterface | $entityFactory | |
Logger | $logger | |
FetchStrategyInterface | $fetchStrategy | |
\Magento\Framework\DB\Adapter\AdapterInterface | $connection |
Definition at line 107 of file AbstractDb.php.
__clone | ( | ) |
Clone $this->_select during cloning collection, otherwise both collections will share the same $this->_select
Definition at line 815 of file AbstractDb.php.
__sleep | ( | ) |
__wakeup | ( | ) |
|
protected |
|
protected |
|
protected |
|
protected |
Fetch collection data
Select | $select |
Definition at line 776 of file AbstractDb.php.
|
protected |
Return the field name for the condition.
string | $fieldName |
Definition at line 491 of file AbstractDb.php.
|
protected |
Build SQL statement for condition
If $condition integer or string - exact value will be filtered ('eq' condition)
If $condition is array - one of the following structures is expected:
If non matched - sequential array is expected and OR conditions will be built using above mentioned structure
string | $fieldName | |
integer | string | array | $condition |
Definition at line 480 of file AbstractDb.php.
|
protected |
Get collection item identifier
\Magento\Framework\DataObject | $item |
Definition at line 169 of file AbstractDb.php.
|
protected |
Try to get mapped field name for filter to collection
string | $field |
Definition at line 422 of file AbstractDb.php.
|
protected |
|
protected |
|
protected |
|
protected |
Render sql select conditions
Definition at line 336 of file AbstractDb.php.
|
protected |
Hook for operations before rendering filters
Definition at line 372 of file AbstractDb.php.
|
protected |
Render sql select limit
Definition at line 518 of file AbstractDb.php.
|
protected |
Render sql select orders
Definition at line 501 of file AbstractDb.php.
|
protected |
Reset collection
Definition at line 759 of file AbstractDb.php.
|
protected |
Specify collection objects id field name
string | $fieldName |
Definition at line 147 of file AbstractDb.php.
|
protected |
Overridden to use _idFieldName by default.
string | null | $valueField | |
string | $labelField | |
array | $additional |
Definition at line 641 of file AbstractDb.php.
|
protected |
Overridden to use _idFieldName by default.
string | $valueField | |
string | $labelField |
Definition at line 656 of file AbstractDb.php.
|
protected |
Build sql where condition part
string | array | $field | |
null | string | array | $condition |
Definition at line 410 of file AbstractDb.php.
addBindParam | ( | $name, | |
$value | |||
) |
Add variable to bind list
string | $name | |
mixed | $value |
Definition at line 135 of file AbstractDb.php.
addFieldToFilter | ( | $field, | |
$condition = null |
|||
) |
Add field filter to collection
string | array | $field | |
null | string | array | $condition |
Definition at line 385 of file AbstractDb.php.
addFilterToMap | ( | $filter, | |
$alias, | |||
$group = 'fields' |
|||
) |
Add filter to Map
string | $filter | |
string | $alias | |
string | $group | default 'fields' |
Definition at line 798 of file AbstractDb.php.
addOrder | ( | $field, | |
$direction = self::SORT_ORDER_DESC |
|||
) |
Sets order and direction.
string | $field | |
string | $direction |
Definition at line 286 of file AbstractDb.php.
|
protected |
Let do something before add loaded item in collection
\Magento\Framework\DataObject | $item |
Definition at line 601 of file AbstractDb.php.
distinct | ( | $flag | ) |
Set select distinct
bool | $flag |
Definition at line 533 of file AbstractDb.php.
fetchItem | ( | ) |
Returns an items collection. Returns a collection item that corresponds to the fetched row and moves the internal data pointer ahead
Definition at line 613 of file AbstractDb.php.
getConnection | ( | ) |
getData | ( | ) |
Get all data array for collection
Definition at line 669 of file AbstractDb.php.
getIdFieldName | ( | ) |
Id field name getter
Definition at line 158 of file AbstractDb.php.
getItemObjectClass | ( | ) |
|
abstract |
Get resource instance.
getSelect | ( | ) |
Get \Magento\Framework\DB\Select instance
Definition at line 197 of file AbstractDb.php.
getSelectCountSql | ( | ) |
Get SQL for get record count
Definition at line 231 of file AbstractDb.php.
getSelectSql | ( | $stringMode = false | ) |
Get sql select string or object
bool | $stringMode |
Definition at line 259 of file AbstractDb.php.
getSize | ( | ) |
Get collection size
Definition at line 217 of file AbstractDb.php.
joinExtensionAttribute | ( | JoinDataInterface | $join, |
JoinProcessorInterface | $extensionAttributesJoinProcessor | ||
) |
Join extension attribute.
JoinDataInterface | $join | |
JoinProcessorInterface | $extensionAttributesJoinProcessor |
Definition at line 839 of file AbstractDb.php.
Load data
bool | $printQuery | |
bool | $logQuery |
Definition at line 556 of file AbstractDb.php.
Load the data.
bool | $printQuery | |
bool | $logQuery |
Definition at line 718 of file AbstractDb.php.
Load data with filter in place
bool | $printQuery | |
bool | $logQuery |
Definition at line 572 of file AbstractDb.php.
Print and/or log query
bool | $printQuery | |
bool | $logQuery | |
string | $sql |
Definition at line 731 of file AbstractDb.php.
resetData | ( | ) |
setConnection | ( | \Magento\Framework\DB\Adapter\AdapterInterface | $conn | ) |
Set database connection adapter
\Magento\Framework\DB\Adapter\AdapterInterface | $conn |
Definition at line 184 of file AbstractDb.php.
setOrder | ( | $field, | |
$direction = self::SORT_ORDER_DESC |
|||
) |
Add select order
string | $field | |
string | $direction |
Definition at line 274 of file AbstractDb.php.
unshiftOrder | ( | $field, | |
$direction = self::SORT_ORDER_DESC |
|||
) |
Add select order to the beginning
string | $field | |
string | $direction |
Definition at line 298 of file AbstractDb.php.
|
protected |
Definition at line 53 of file AbstractDb.php.
|
protected |
Definition at line 30 of file AbstractDb.php.
|
protected |
Definition at line 61 of file AbstractDb.php.
|
protected |
Definition at line 75 of file AbstractDb.php.
|
protected |
Definition at line 46 of file AbstractDb.php.
|
protected |
Definition at line 82 of file AbstractDb.php.
|
protected |
Definition at line 87 of file AbstractDb.php.
|
protected |
Definition at line 68 of file AbstractDb.php.
|
protected |
Definition at line 37 of file AbstractDb.php.
|
protected |
Definition at line 99 of file AbstractDb.php.