PHP 클래스 eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery

상속: extends AbstractDoctrineQuery, implements eZ\Publish\Core\Persistence\Database\SelectQuery
파일 보기 프로젝트 열기: ezsystems/ezpublish-kernel 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$permissionSubtreeJoinAdded boolean Holds the state of permission subtree join, which is LEFT JOIN on 'ezcontentobject_tree' table with alias 'permission_subtree'.

공개 메소드들

메소드 설명
alias ( string $name, string $alias ) : string Returns SQL to create an alias.
from ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery Select which tables you want to select from.
getQuery ( ) : string Returns the query string for this query object.
groupBy ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery Returns SQL that groups the result set by a given column.
having ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery Returns SQL that set having by a given expression.
innerJoin ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery Returns the SQL for an inner join or prepares $fromString for an inner join.
leftJoin ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery Returns the SQL for a left join or prepares $fromString for a left join.
limit ( string $limit, string $offset = '' ) : eZ\Publish\Core\Persistence\Database\SelectQuery Returns SQL that limits the result set.
orderBy ( string $column, string $type = self::ASC ) : eZ\Publish\Core\Persistence\Database\SelectQuery Returns SQL that orders the result set by a given column.
rightJoin ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery Returns the SQL for a right join or prepares $fromString for a right join.
select ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery Opens the query and selects which columns you want to return with the query.
selectDistinct ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery Opens the query and uses a distinct select on the columns you want to return with the query.
where ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery Adds a where clause with logical expressions to the query.

보호된 메소드들

메소드 설명
doJoin ( string $type, array $args ) : eZ\Publish\Core\Persistence\Database\SelectQuery Helper function to generate join.

메소드 상세

alias() 공개 메소드

This method can be used to create an alias for either a table or a column. Example: this will make the table users have the alias employees and the column user_id the alias employee_id $q->select( $q->alias( 'user_id', 'employee_id' ) ->from( $q->alias( 'users', 'employees' ) );
public alias ( string $name, string $alias ) : string
$name string
$alias string
리턴 string the query string "columnname as targetname"

doJoin() 보호된 메소드

Helper function to generate join.
protected doJoin ( string $type, array $args ) : eZ\Publish\Core\Persistence\Database\SelectQuery
$type string
$args array
리턴 eZ\Publish\Core\Persistence\Database\SelectQuery

from() 공개 메소드

from() accepts an arbitrary number of parameters. Each parameter must contain either the name of a table or an array containing the names of tables.. Each call to from() appends tables to the list of tables that will be used in the query. Example: the following code will produce the SQL SELECT id FROM table_name $q->select( 'id' )->from( 'table_name' );
public from ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery
리턴 eZ\Publish\Core\Persistence\Database\SelectQuery a pointer to $this

getQuery() 공개 메소드

Returns the query string for this query object.
public getQuery ( ) : string
리턴 string

groupBy() 공개 메소드

You can call groupBy multiple times. Each call will add a column to group by. Example: $q->select( '*' )->from( 'table' ) ->groupBy( 'id' );
public groupBy ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery
리턴 eZ\Publish\Core\Persistence\Database\SelectQuery a pointer to $this

having() 공개 메소드

You can call having multiple times. Each call will add an expression with a logical and. Example: $q->select( '*' )->from( 'table' )->groupBy( 'id' ) ->having( $q->expr->eq('id',1) );
public having ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery
리턴 eZ\Publish\Core\Persistence\Database\SelectQuery a pointer to $this

innerJoin() 공개 메소드

This method could be used in two forms: innerJoin( 't2', $joinCondition ) Takes 2 string arguments and returns \eZ\Publish\Core\Persistence\Database\SelectQuery. The first parameter is the name of the table to join with. The table to which is joined should have been previously set with the from() method. The second parameter should be a string containing a join condition that is returned by an \eZ\Publish\Core\Persistence\Database\SelectQueryExpression. Example: the following code will produce the SQL SELECT id FROM t1 INNER JOIN t2 ON t1.id = t2.id $q->select( 'id' )->from( 't1' )->innerJoin( 't2', $q->expr->eq('t1.id', 't2.id' ) ); innerJoin( 't2', 't1.id', 't2.id' ) Takes 3 string arguments and returns \eZ\Publish\Core\Persistence\Database\SelectQuery. This is a simplified form of the 2 parameter version. innerJoin( 't2', 't1.id', 't2.id' ) is equal to innerJoin( 't2', $this->expr->eq('t1.id', 't2.id' ) ); The first parameter is the name of the table to join with. The table to which is joined should have been previously set with the from() method. The second parameter is the name of the column on the table set previously with the from() method and the third parameter the name of the column to join with on the table that was specified in the first parameter. Example: the following code will produce the SQL SELECT id FROM t1 INNER JOIN t2 ON t1.id = t2.id $q->select( 'id' )->from( 't1' )->innerJoin( 't2', 't1.id', 't2.id' );
public innerJoin ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery
리턴 eZ\Publish\Core\Persistence\Database\SelectQuery

leftJoin() 공개 메소드

This method could be used in two forms: leftJoin( 't2', $joinCondition ) Takes 2 string arguments and returns \eZ\Publish\Core\Persistence\Database\SelectQuery. The first parameter is the name of the table to join with. The table to which is joined should have been previously set with the from() method. The second parameter should be a string containing a join condition that is returned by an \eZ\Publish\Core\Persistence\Database\SelectQueryExpression. Example: the following code will produce the SQL SELECT id FROM t1 LEFT JOIN t2 ON t1.id = t2.id $q->select( 'id' )->from( 't1' )->leftJoin( 't2', $q->expr->eq('t1.id', 't2.id' ) ); leftJoin( 't2', 't1.id', 't2.id' ) Takes 3 string arguments and returns \eZ\Publish\Core\Persistence\Database\SelectQuery. This is a simplified form of the 2 parameter version. leftJoin( 't2', 't1.id', 't2.id' ) is equal to leftJoin( 't2', $this->expr->eq('t1.id', 't2.id' ) ); The first parameter is the name of the table to join with. The table to which is joined should have been previously set with the from() method. The second parameter is the name of the column on the table set previously with the from() method and the third parameter the name of the column to join with on the table that was specified in the first parameter. Example: the following code will produce the SQL SELECT id FROM t1 LEFT JOIN t2 ON t1.id = t2.id $q->select( 'id' )->from( 't1' )->leftJoin( 't2', 't1.id', 't2.id' );
public leftJoin ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery
리턴 eZ\Publish\Core\Persistence\Database\SelectQuery

limit() 공개 메소드

$limit controls the maximum number of rows that will be returned. $offset controls which row that will be the first in the result set from the total amount of matching rows. Example: $q->select( '*' )->from( 'table' ) ->limit( 10, 0 ); LIMIT is not part of SQL92. It is implemented here anyway since all databases support it one way or the other and because it is essential.
public limit ( string $limit, string $offset = '' ) : eZ\Publish\Core\Persistence\Database\SelectQuery
$limit string integer expression
$offset string integer expression
리턴 eZ\Publish\Core\Persistence\Database\SelectQuery

orderBy() 공개 메소드

You can call orderBy multiple times. Each call will add a column to order by. Example: $q->select( '*' )->from( 'table' ) ->orderBy( 'id' );
public orderBy ( string $column, string $type = self::ASC ) : eZ\Publish\Core\Persistence\Database\SelectQuery
$column string a column name in the result set
$type string if the column should be sorted ascending or descending. you can specify this using \eZ\Publish\Core\Persistence\Database\SelectQuery::ASC or \eZ\Publish\Core\Persistence\Database\SelectQuery::DESC
리턴 eZ\Publish\Core\Persistence\Database\SelectQuery a pointer to $this

rightJoin() 공개 메소드

This method could be used in two forms: rightJoin( 't2', $joinCondition ) Takes 2 string arguments and returns \eZ\Publish\Core\Persistence\Database\SelectQuery. The first parameter is the name of the table to join with. The table to which is joined should have been previously set with the from() method. The second parameter should be a string containing a join condition that is returned by an \eZ\Publish\Core\Persistence\Database\SelectQueryExpression. Example: the following code will produce the SQL SELECT id FROM t1 LEFT JOIN t2 ON t1.id = t2.id $q->select( 'id' )->from( 't1' )->rightJoin( 't2', $q->expr->eq('t1.id', 't2.id' ) ); rightJoin( 't2', 't1.id', 't2.id' ) Takes 3 string arguments and returns \eZ\Publish\Core\Persistence\Database\SelectQuery. This is a simplified form of the 2 parameter version. rightJoin( 't2', 't1.id', 't2.id' ) is equal to rightJoin( 't2', $this->expr->eq('t1.id', 't2.id' ) ); The first parameter is the name of the table to join with. The table to which is joined should have been previously set with the from() method. The second parameter is the name of the column on the table set previously with the from() method and the third parameter the name of the column to join with on the table that was specified in the first parameter. Example: the following code will produce the SQL SELECT id FROM t1 LEFT JOIN t2 ON t1.id = t2.id $q->select( 'id' )->from( 't1' )->rightJoin( 't2', 't1.id', 't2.id' );
public rightJoin ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery
리턴 eZ\Publish\Core\Persistence\Database\SelectQuery

select() 공개 메소드

select() accepts an arbitrary number of parameters. Each parameter must contain either the name of a column or an array containing the names of the columns. Each call to select() appends columns to the list of columns that will be used in the query. Example: $q->select( 'column1', 'column2' ); The same could also be written $columns[] = 'column1'; $columns[] = 'column2; $q->select( $columns ); or using several calls $q->select( 'column1' )->select( 'column2' ); Each of above code produce SQL clause 'SELECT column1, column2' for the query.
public select ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery
리턴 eZ\Publish\Core\Persistence\Database\SelectQuery returns a pointer to $this.

selectDistinct() 공개 메소드

selectDistinct() accepts an arbitrary number of parameters. Each parameter must contain either the name of a column or an array containing the names of the columns. Each call to selectDistinct() appends columns to the list of columns that will be used in the query. Example: $q->selectDistinct( 'column1', 'column2' ); The same could also be written $columns[] = 'column1'; $columns[] = 'column2; $q->selectDistinct( $columns ); or using several calls $q->selectDistinct( 'column1' )->select( 'column2' ); Each of above code produce SQL clause 'SELECT DISTINCT column1, column2' for the query. You may call select() after calling selectDistinct() which will result in the additional columns beein added. A call of selectDistinct() after select() will result in an \eZ\Publish\Core\Persistence\Database\SelectQueryInvalidException.
public selectDistinct ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery
리턴 eZ\Publish\Core\Persistence\Database\SelectQuery returns a pointer to $this.

where() 공개 메소드

where() accepts an arbitrary number of parameters. Each parameter must contain a logical expression or an array with logical expressions. If you specify multiple logical expression they are connected using a logical and. Multiple calls to where() will join the expressions using a logical and. Example: $q->select( '*' )->from( 'table' )->where( $q->expr->eq( 'id', 1 ) );
public where ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery
리턴 eZ\Publish\Core\Persistence\Database\SelectQuery

프로퍼티 상세

$permissionSubtreeJoinAdded 공개적으로 프로퍼티

Holds the state of permission subtree join, which is LEFT JOIN on 'ezcontentobject_tree' table with alias 'permission_subtree'.
또한 보기: eZ\Publish\Core\Search\Legacy\Content\Gateway\CriterionHandler\PermissionSubtree
또한 보기: https://jira.ez.no/browse/EZP-23037
public bool $permissionSubtreeJoinAdded
리턴 boolean