PHP Класс phpDataMapper_Query, phpDataMapper

Автор: Vance Lucas ([email protected])
Наследование: implements Countable, implements IteratorAggregate
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$conditions
$fields Storage for query properties
$group
$limit
$limitOffset
$order
$source

Защищенные свойства (Protected)

Свойство Тип Описание
$_mapper

Открытые методы

Метод Описание
__construct ( phpDataMapper_Base $mapper ) Constructor Method
all ( array $conditions = [] ) Find records with given conditions If all parameters are empty, find all records
andWhere ( array $conditions = [], $type = "AND" )
count ( ) : integer SPL Countable function Called automatically when attribute is used in a 'count()' function call
execute ( ) : mixed Execute and return query as a collection
first ( ) : mixed Return the first entity matched by the query
from ( string $source = null ) From
getIterator ( ) : phpDataMapper_Query_Set SPL IteratorAggregate function Called automatically when attribute is used in a 'foreach' loop
group ( array $fields = [] ) GROUP BY clause
limit ( integer $limit = 20, integer $offset = null ) Limit executed query to specified amount of rows Implemented at adapter-level for databases that support it
mapper ( ) Get current adapter object
orWhere ( array $conditions = [], $type = "AND" )
order ( array $fields = [] ) ORDER BY columns
params ( ) : array Return array of parameters in key => value format
select ( mixed $fields = "*", string $source = null ) : string Called from mapper's select() function
toArray ( $keyColumn = null, $valueColumn = null ) : array Convenience function passthrough for Collection
where ( array $conditions = [], string $type = "AND", string $setType = "AND" ) WHERE conditions

Описание методов

__construct() публичный Метод

Constructor Method
public __construct ( phpDataMapper_Base $mapper )
$mapper phpDataMapper_Base

all() публичный Метод

Find records with given conditions If all parameters are empty, find all records
public all ( array $conditions = [] )
$conditions array Array of conditions in column => value pairs

andWhere() публичный Метод

public andWhere ( array $conditions = [], $type = "AND" )
$conditions array

count() публичный Метод

SPL Countable function Called automatically when attribute is used in a 'count()' function call
public count ( ) : integer
Результат integer

execute() публичный Метод

Execute and return query as a collection
public execute ( ) : mixed
Результат mixed Collection object on success, boolean false on failure

first() публичный Метод

Return the first entity matched by the query
public first ( ) : mixed
Результат mixed phpDataMapper_Entity on success, boolean false on failure

from() публичный Метод

From
public from ( string $source = null )
$source string Name of the data source to perform a query on

getIterator() публичный Метод

SPL IteratorAggregate function Called automatically when attribute is used in a 'foreach' loop
public getIterator ( ) : phpDataMapper_Query_Set
Результат phpDataMapper_Query_Set

group() публичный Метод

GROUP BY clause
public group ( array $fields = [] )
$fields array Array of field names to use for grouping

limit() публичный Метод

Limit executed query to specified amount of rows Implemented at adapter-level for databases that support it
public limit ( integer $limit = 20, integer $offset = null )
$limit integer Number of records to return
$offset integer Row to start at for limited result set

mapper() публичный Метод

Get current adapter object
public mapper ( )

orWhere() публичный Метод

public orWhere ( array $conditions = [], $type = "AND" )
$conditions array

order() публичный Метод

ORDER BY columns
public order ( array $fields = [] )
$fields array Array of field names to use for sorting

params() публичный Метод

Return array of parameters in key => value format
public params ( ) : array
Результат array Parameters in key => value format

select() публичный Метод

Called from mapper's select() function
public select ( mixed $fields = "*", string $source = null ) : string
$fields mixed (optional)
$source string Data source name
Результат string

toArray() публичный Метод

Convenience function passthrough for Collection
public toArray ( $keyColumn = null, $valueColumn = null ) : array
Результат array

where() публичный Метод

WHERE conditions
public where ( array $conditions = [], string $type = "AND", string $setType = "AND" )
$conditions array Array of conditions for this clause
$type string Keyword that will separate each condition - "AND", "OR"
$setType string Keyword that will separate the whole set of conditions - "AND", "OR"

Описание свойств

$_mapper защищенное свойство

protected $_mapper

$conditions публичное свойство

public $conditions

$fields публичное свойство

Storage for query properties
public $fields

$group публичное свойство

public $group

$limit публичное свойство

public $limit

$limitOffset публичное свойство

public $limitOffset

$order публичное свойство

public $order

$source публичное свойство

public $source