PHP Class phpDataMapper_Query, phpDataMapper

Author: Vance Lucas ([email protected])
Inheritance: implements Countable, implements IteratorAggregate
Afficher le fichier Open project: vlucas/phpDataMapper Class Usage Examples

Méthodes publiques

Свойство Type Description
$conditions
$fields Storage for query properties
$group
$limit
$limitOffset
$order
$source

Protected Properties

Свойство Type Description
$_mapper

Méthodes publiques

Méthode Description
__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

Method Details

__construct() public méthode

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

all() public méthode

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 méthode

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

count() public méthode

SPL Countable function Called automatically when attribute is used in a 'count()' function call
public count ( ) : integer
Résultat integer

execute() public méthode

Execute and return query as a collection
public execute ( ) : mixed
Résultat mixed Collection object on success, boolean false on failure

first() public méthode

Return the first entity matched by the query
public first ( ) : mixed
Résultat mixed phpDataMapper_Entity on success, boolean false on failure

from() public méthode

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

getIterator() public méthode

SPL IteratorAggregate function Called automatically when attribute is used in a 'foreach' loop
public getIterator ( ) : phpDataMapper_Query_Set
Résultat phpDataMapper_Query_Set

group() public méthode

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

limit() public méthode

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() public méthode

Get current adapter object
public mapper ( )

orWhere() public méthode

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

order() public méthode

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

params() public méthode

Return array of parameters in key => value format
public params ( ) : array
Résultat array Parameters in key => value format

select() public méthode

Called from mapper's select() function
public select ( mixed $fields = "*", string $source = null ) : string
$fields mixed (optional)
$source string Data source name
Résultat string

toArray() public méthode

Convenience function passthrough for Collection
public toArray ( $keyColumn = null, $valueColumn = null ) : array
Résultat array

where() public méthode

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"

Property Details

$_mapper protected_oe property

protected $_mapper

$conditions public_oe property

public $conditions

$fields public_oe property

Storage for query properties
public $fields

$group public_oe property

public $group

$limit public_oe property

public $limit

$limitOffset public_oe property

public $limitOffset

$order public_oe property

public $order

$source public_oe property

public $source