PHP Class Horde_Rdo_Query, horde

Afficher le fichier Open project: horde/horde Class Usage Examples

Méthodes publiques

Свойство Type Description
$conjunction string
$distinct boolean
$fields array
$limit integer
$limitOffset integer
$mapper Horde_Rdo_Mapper
$relationships array
$tests array

Protected Properties

Свойство Type Description
$_aliasCount integer
$_aliases array
$_sortby array

Méthodes publiques

Méthode Description
__construct ( Horde_Rdo_Mapper $mapper = null ) Constructor.
__get ( string $key ) Accessor for any fields that we want some logic around.
addFields ( array $fields, string $fieldPrefix = null ) : Horde_Rdo_Query Adds fields to return with the query.
addRelationship ( string $relationship, array $args ) : Horde_Rdo_Query Adds a relationship type to a query.
addTest ( $field, $test, $value )
clearSort ( )
combineWith ( string $conjunction )
create ( mixed $query, Horde_Rdo_Mapper $mapper = null ) : Horde_Rdo_Query Turn any of the acceptable query shorthands into a full Horde_Rdo_Query object. If you pass an existing Horde_Rdo_Query object in, it will be cloned before it's returned so that it can be safely modified.
distinct ( boolean $distinct ) : Horde_Rdo_Query Makes the query return only distinct (different) values.
getQuery ( ) : array Query generator.
limit ( integer $limit, integer $offset = null ) Restrict the query to a subset of the results.
setFields ( array $fields, string $fieldPrefix = null ) : Horde_Rdo_Query Sets the fields to return with the query.
setMapper ( Horde_Rdo_Mapper $mapper ) : Horde_Rdo_Query
sortBy ( string $sort ) Add a sorting rule.

Méthodes protégées

Méthode Description
_alias ( $tableName ) Get a unique table alias
_fillJoinPlaceholders ( Horde_Rdo_Mapper $m1, Horde_Rdo_Mapper $m2, array $query ) : array Take a query array and replace @field@ placeholders with values that will match in the load query.
_from ( &$sql, &$bindParams )
_join ( &$sql, &$bindParams )
_limit ( &$sql, &$bindParams )
_orderBy ( &$sql, &$bindParams )
_prefix ( &$fieldName, $key, $prefix ) Callback for array_walk to prefix all elements of an array with a given prefix.
_select ( &$sql, &$bindParams )
_where ( &$sql, &$bindParams )

Method Details

__construct() public méthode

Constructor.
public __construct ( Horde_Rdo_Mapper $mapper = null )
$mapper Horde_Rdo_Mapper Rdo mapper base class

__get() public méthode

Accessor for any fields that we want some logic around.
public __get ( string $key )
$key string

_alias() protected méthode

Get a unique table alias
protected _alias ( $tableName )

_fillJoinPlaceholders() protected méthode

Take a query array and replace @field@ placeholders with values that will match in the load query.
protected _fillJoinPlaceholders ( Horde_Rdo_Mapper $m1, Horde_Rdo_Mapper $m2, array $query ) : array
$m1 Horde_Rdo_Mapper Left-hand mapper
$m2 Horde_Rdo_Mapper Right-hand mapper
$query array The query to process placeholders on.
Résultat array The query with placeholders filled in.

_from() protected méthode

protected _from ( &$sql, &$bindParams )

_join() protected méthode

protected _join ( &$sql, &$bindParams )

_limit() protected méthode

protected _limit ( &$sql, &$bindParams )

_orderBy() protected méthode

protected _orderBy ( &$sql, &$bindParams )

_prefix() protected méthode

Callback for array_walk to prefix all elements of an array with a given prefix.
protected _prefix ( &$fieldName, $key, $prefix )

_select() protected méthode

protected _select ( &$sql, &$bindParams )

_where() protected méthode

protected _where ( &$sql, &$bindParams )

addFields() public méthode

Adds fields to return with the query.
public addFields ( array $fields, string $fieldPrefix = null ) : Horde_Rdo_Query
$fields array Additional fields to load with this query.
$fieldPrefix string Prefix all field names with this string.
Résultat Horde_Rdo_Query Returns self for fluent method chaining.

addRelationship() public méthode

Adds a relationship type to a query.
public addRelationship ( string $relationship, array $args ) : Horde_Rdo_Query
$relationship string The name of the relationship as defined in the mapper.
$args array The parameter array as defined in the mapper: - mapper: The mapper object of the result class. - table: Optional name of the table to use. - tableAlias: Optional alias name for the base table. - join_type: Optional explicitly control the type of join. - type: The type of relation, any of the constants in Horde_Rdo.
Résultat Horde_Rdo_Query This object.

addTest() public méthode

public addTest ( $field, $test, $value )

clearSort() public méthode

public clearSort ( )

combineWith() public méthode

public combineWith ( string $conjunction )
$conjunction string SQL conjunction such as "AND", "OR".

create() public static méthode

Turn any of the acceptable query shorthands into a full Horde_Rdo_Query object. If you pass an existing Horde_Rdo_Query object in, it will be cloned before it's returned so that it can be safely modified.
public static create ( mixed $query, Horde_Rdo_Mapper $mapper = null ) : Horde_Rdo_Query
$query mixed The query to convert to an object.
$mapper Horde_Rdo_Mapper The Mapper object governing this query.
Résultat Horde_Rdo_Query The full Horde_Rdo_Query object.

distinct() public méthode

Makes the query return only distinct (different) values.
public distinct ( boolean $distinct ) : Horde_Rdo_Query
$distinct boolean Whether to enable a distinct query.
Résultat Horde_Rdo_Query Returns self for fluent method chaining.

getQuery() public méthode

Query generator.
public getQuery ( ) : array
Résultat array A two-element array of the SQL query and an array of bind parameters.

limit() public méthode

Restrict the query to a subset of the results.
public limit ( integer $limit, integer $offset = null )
$limit integer Number of items to fetch.
$offset integer Offset to start fetching at.

setFields() public méthode

Sets the fields to return with the query.
public setFields ( array $fields, string $fieldPrefix = null ) : Horde_Rdo_Query
$fields array The fields to load with this query.
$fieldPrefix string Prefix all field names with this string.
Résultat Horde_Rdo_Query Returns self for fluent method chaining.

setMapper() public méthode

public setMapper ( Horde_Rdo_Mapper $mapper ) : Horde_Rdo_Query
$mapper Horde_Rdo_Mapper Rdo mapper base class
Résultat Horde_Rdo_Query Return the query object for fluent chaining.

sortBy() public méthode

Add a sorting rule.
public sortBy ( string $sort )
$sort string SQL sort fragment, such as 'updated DESC'

Property Details

$_aliasCount protected_oe property

protected int $_aliasCount
Résultat integer

$_aliases protected_oe property

protected array $_aliases
Résultat array

$_sortby protected_oe property

protected array $_sortby
Résultat array

$conjunction public_oe property

public string $conjunction
Résultat string

$distinct public_oe property

public bool $distinct
Résultat boolean

$fields public_oe property

public array $fields
Résultat array

$limit public_oe property

public int $limit
Résultat integer

$limitOffset public_oe property

public int $limitOffset
Résultat integer

$mapper public_oe property

public Horde_Rdo_Mapper $mapper
Résultat Horde_Rdo_Mapper

$relationships public_oe property

public array $relationships
Résultat array

$tests public_oe property

public array $tests
Résultat array