PHP 클래스 Spot\Query

저자: Vance Lucas ([email protected])
상속: implements Countable, implements IteratorAggregate, implements spot\QueryInterface
파일 보기 프로젝트 열기: vlucas/spot2 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_customMethods array Custom methods added by extensions or plugins
$_data array Storage for eager-loaded relations
$_entityName string
$_mapper Mapper
$_noQuote boolean
$_queryBuilder
$_tableName string
$_whereOperatorObjects array Already instantiated operator objects
$_whereOperators array
$with array Storage for query properties

공개 메소드들

메소드 설명
__call ( string $method, array $args ) : mixed Run user-added callback
__construct ( Mapper $mapper ) Constructor Method
addMethod ( string $method, callable $callback ) Add a custom user method via closure or PHP callback
addWhereOperator ( string $operator, callable | string $action ) Adds a custom type to the type map.
andWhere ( array $where, string $type = 'AND' ) WHERE AND conditions
builder ( ) : Doctrine\DBAL\Query\QueryBuilder Get current Doctrine DBAL query builder object
count ( ) : integer SPL Countable function Called automatically when attribute is used in a 'count()' function call
delete ( ) Delete (passthrough to DBAL QueryBuilder)
entityName ( ) : string Get current entity name query is to be performed on
escape ( string $string ) : string Escape/quote direct user input
escapeIdentifier ( string | array $identifier ) : string | array Escape/quote identifier
execute ( ) : mixed Execute and return query as a collection
expr ( ) : Doctrine\DBAL\Query\Expression\ExpressionBuilder Return DBAL Query builder expression
fieldWithAlias ( string $field, boolean $escaped = true ) : string Get field name with table alias appended
first ( ) : mixed Return the first entity matched by the query
from ( ) From (passthrough to DBAL QueryBuilder)
getIterator ( ) : Collection SPL IteratorAggregate function Called automatically when attribute is used in a 'foreach' loop
getParameters ( ) : mixed Get all bound query parameters (passthrough to DBAL QueryBuilder)
group ( array $fields = [] ) GROUP BY clause
having ( array $having, string $type = 'AND' ) Having clause to filter results by a calculated value
jsonSerialize ( ) JsonSerializable
limit ( integer $limit, integer $offset = null ) Limit executed query to specified amount of records Implemented at adapter-level for databases that support it
mapper ( ) : Mapper Get current adapter object
noQuote ( boolean $noQuote = true ) Set field and value quoting on/off - maily used for testing output SQL since quoting is different per platform
offset ( integer $offset ) Offset executed query to skip specified amount of records Implemented at adapter-level for databases that support it
offsetExists ( $key ) SPL - ArrayAccess
offsetGet ( $key ) SPL - ArrayAccess
offsetSet ( $key, $value ) SPL - ArrayAccess
offsetUnset ( $key ) SPL - ArrayAccess
orWhere ( array $where, string $type = 'AND' ) WHERE OR conditions
order ( array $order ) ORDER BY columns
search ( mixed $fields, string $query, array $options = [] ) Search criteria (FULLTEXT, LIKE, or REGEX, depending on storage engine and driver)
select ( ) Select (passthrough to DBAL QueryBuilder)
setParameters ( ) Set query parameters (passthrough to DBAL QueryBuilder)
toArray ( string | null $keyColumn = null, string | null $valueColumn = null ) : array Convenience function passthrough for Collection
toSql ( ) : string Get raw SQL string from built query
unescapeIdentifier ( string $identifier ) : string Removes escape/quote character
where ( array $where, string $type = 'AND' ) WHERE conditions
whereFieldSql ( string $field, string $sql, array $params = [] ) WHERE field + raw SQL
whereSql ( string $sql ) WHERE conditions
with ( mixed | null $relations = null ) Relations to be eager-loaded

비공개 메소드들

메소드 설명
getWhereOperatorCallable ( string $operator ) : callable | false
parseWhereToSQLFragments ( array $where, boolean $useAlias = true ) : array Parse array-syntax WHERE conditions and translate them to DBAL QueryBuilder syntax

메소드 상세

__call() 공개 메소드

Run user-added callback
public __call ( string $method, array $args ) : mixed
$method string Method name called
$args array Array of arguments used in missing method call
리턴 mixed

__construct() 공개 메소드

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

addMethod() 공개 정적인 메소드

Add a custom user method via closure or PHP callback
public static addMethod ( string $method, callable $callback )
$method string Method name to add
$callback callable Callback or closure that will be executed when missing method call matching $method is made

addWhereOperator() 공개 정적인 메소드

Adds a custom type to the type map.
public static addWhereOperator ( string $operator, callable | string $action )
$operator string
$action callable | string

andWhere() 공개 메소드

WHERE AND conditions
public andWhere ( array $where, string $type = 'AND' )
$where array Array of conditions for this clause
$type string Keyword that will separate each condition - "AND", "OR"

builder() 공개 메소드

Get current Doctrine DBAL query builder object
public builder ( ) : Doctrine\DBAL\Query\QueryBuilder
리턴 Doctrine\DBAL\Query\QueryBuilder

count() 공개 메소드

Executes separate query with COUNT(*), and drops and ordering (not important for counting)
public count ( ) : integer
리턴 integer

delete() 공개 메소드

Delete (passthrough to DBAL QueryBuilder)
public delete ( )

entityName() 공개 메소드

Get current entity name query is to be performed on
public entityName ( ) : string
리턴 string

escape() 공개 메소드

Escape/quote direct user input
public escape ( string $string ) : string
$string string
리턴 string

escapeIdentifier() 공개 메소드

Escape/quote identifier
public escapeIdentifier ( string | array $identifier ) : string | array
$identifier string | array
리턴 string | array

execute() 공개 메소드

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

expr() 공개 메소드

Return DBAL Query builder expression
public expr ( ) : Doctrine\DBAL\Query\Expression\ExpressionBuilder
리턴 Doctrine\DBAL\Query\Expression\ExpressionBuilder

fieldWithAlias() 공개 메소드

Get field name with table alias appended
public fieldWithAlias ( string $field, boolean $escaped = true ) : string
$field string
$escaped boolean
리턴 string

first() 공개 메소드

Return the first entity matched by the query
public first ( ) : mixed
리턴 mixed Spot_Entity on success, boolean false on failure

from() 공개 메소드

From (passthrough to DBAL QueryBuilder)
public from ( )

getIterator() 공개 메소드

SPL IteratorAggregate function Called automatically when attribute is used in a 'foreach' loop
public getIterator ( ) : Collection
리턴 Spot\Entity\Collection

getParameters() 공개 메소드

Get all bound query parameters (passthrough to DBAL QueryBuilder)
public getParameters ( ) : mixed
리턴 mixed

group() 공개 메소드

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

having() 공개 메소드

Having clause to filter results by a calculated value
public having ( array $having, string $type = 'AND' )
$having array Array (like where) for HAVING statement for filter records by
$type string

jsonSerialize() 공개 메소드

JsonSerializable
public jsonSerialize ( )

limit() 공개 메소드

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

mapper() 공개 메소드

Get current adapter object
public mapper ( ) : Mapper
리턴 Mapper

noQuote() 공개 메소드

Set field and value quoting on/off - maily used for testing output SQL since quoting is different per platform
public noQuote ( boolean $noQuote = true )
$noQuote boolean

offset() 공개 메소드

Offset executed query to skip specified amount of records Implemented at adapter-level for databases that support it
public offset ( integer $offset )
$offset integer Record to start at for limited result set

offsetExists() 공개 메소드

SPL - ArrayAccess
public offsetExists ( $key )

offsetGet() 공개 메소드

SPL - ArrayAccess
public offsetGet ( $key )

offsetSet() 공개 메소드

SPL - ArrayAccess
public offsetSet ( $key, $value )

offsetUnset() 공개 메소드

SPL - ArrayAccess
public offsetUnset ( $key )

orWhere() 공개 메소드

WHERE OR conditions
public orWhere ( array $where, string $type = 'AND' )
$where array Array of conditions for this clause
$type string Keyword that will separate each condition - "AND", "OR"

order() 공개 메소드

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

select() 공개 메소드

Select (passthrough to DBAL QueryBuilder)
public select ( )

setParameters() 공개 메소드

Set query parameters (passthrough to DBAL QueryBuilder)
public setParameters ( )

toArray() 공개 메소드

Convenience function passthrough for Collection
public toArray ( string | null $keyColumn = null, string | null $valueColumn = null ) : array
$keyColumn string | null
$valueColumn string | null
리턴 array

toSql() 공개 메소드

Get raw SQL string from built query
public toSql ( ) : string
리턴 string

unescapeIdentifier() 공개 메소드

Removes escape/quote character
public unescapeIdentifier ( string $identifier ) : string
$identifier string
리턴 string

where() 공개 메소드

WHERE conditions
public where ( array $where, string $type = 'AND' )
$where array Array of conditions for this clause
$type string Keyword that will separate each condition - "AND", "OR"

whereFieldSql() 공개 메소드

WHERE field + raw SQL
public whereFieldSql ( string $field, string $sql, array $params = [] )
$field string Field name for SQL statement (will be quoted)
$sql string SQL string to put in WHERE clause
$params array

whereSql() 공개 메소드

WHERE conditions
public whereSql ( string $sql )
$sql string SQL string to put in WHERE clause

with() 공개 메소드

Relations to be eager-loaded
public with ( mixed | null $relations = null )
$relations mixed | null Array/string of relation(s) to be loaded.

프로퍼티 상세

$_customMethods 보호되어 있는 정적으로 프로퍼티

Custom methods added by extensions or plugins
protected static array $_customMethods
리턴 array

$_data 보호되어 있는 프로퍼티

Storage for eager-loaded relations
protected array $_data
리턴 array

$_entityName 보호되어 있는 프로퍼티

protected string $_entityName
리턴 string

$_mapper 보호되어 있는 프로퍼티

protected Mapper,Spot $_mapper
리턴 Mapper

$_noQuote 보호되어 있는 프로퍼티

protected bool $_noQuote
리턴 boolean

$_queryBuilder 보호되어 있는 프로퍼티

protected $_queryBuilder

$_tableName 보호되어 있는 프로퍼티

protected string $_tableName
리턴 string

$_whereOperatorObjects 보호되어 있는 정적으로 프로퍼티

Already instantiated operator objects
protected static array $_whereOperatorObjects
리턴 array

$_whereOperators 보호되어 있는 정적으로 프로퍼티

protected static array $_whereOperators
리턴 array

$with 보호되어 있는 프로퍼티

Storage for query properties
protected array $with
리턴 array