Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields
MapperInterface Interface Reference
Inheritance diagram for MapperInterface:
AbstractMapper GenericMapper StockItemCriteriaMapper StockStatusCriteriaMapper StockCriteriaMapper

Public Member Functions

 map (\Magento\Framework\Api\CriteriaInterface $criteria)
 
 getResource ()
 
 addExpressionFieldToSelect ($alias, $expression, $fields)
 
 addFieldToFilter ($field, $condition=null)
 
 reset ()
 

Data Fields

const SORT_ORDER_ASC = 'ASC'
 
const SORT_ORDER_DESC = 'DESC'
 

Detailed Description

Interface MapperInterface

Definition at line 11 of file MapperInterface.php.

Member Function Documentation

◆ addExpressionFieldToSelect()

addExpressionFieldToSelect (   $alias,
  $expression,
  $fields 
)

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.

Parameters
string$alias
string$expression
array | string$fields
Returns
$this

Implemented in AbstractMapper.

◆ addFieldToFilter()

addFieldToFilter (   $field,
  $condition = null 
)

Add field filter to collection

If $condition integer or string - exact value will be filtered ('eq' condition)

If $condition is array - one of the following structures is expected:

  • ["from" => $fromValue, "to" => $toValue]
  • ["eq" => $equalValue]
  • ["neq" => $notEqualValue]
  • ["like" => $likeValue]
  • ["in" => [$inValues]]
  • ["nin" => [$notInValues]]
  • ["notnull" => $valueIsNotNull]
  • ["null" => $valueIsNull]
  • ["moreq" => $moreOrEqualValue]
  • ["gt" => $greaterValue]
  • ["lt" => $lessValue]
  • ["gteq" => $greaterOrEqualValue]
  • ["lteq" => $lessOrEqualValue]
  • ["finset" => $valueInSet]
If non matched - sequential parallel arrays are expected and OR conditions
will be built using above mentioned structure.
Example:
$field = ['age', 'name'];
$condition = [42, ['like' => 'Mage']];

The above would find where age equal to 42 OR name like Mage%.

Parameters
string | array$field
string | int | array$condition
Exceptions

Implemented in AbstractMapper.

◆ getResource()

getResource ( )

Get resource instance

Returns
\Magento\Framework\Model\ResourceModel\Db\AbstractDb

Implemented in AbstractMapper.

◆ map()

Map criteria to Select Query Object

Parameters
\Magento\Framework\Api\CriteriaInterface$criteria
Returns
Select

◆ reset()

reset ( )

Reset Select object state

Returns
void

Implemented in AbstractMapper.

Field Documentation

◆ SORT_ORDER_ASC

const SORT_ORDER_ASC = 'ASC'

Definition at line 13 of file MapperInterface.php.

◆ SORT_ORDER_DESC

const SORT_ORDER_DESC = 'DESC'

Definition at line 15 of file MapperInterface.php.


The documentation for this interface was generated from the following file: