Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes | List of all members
eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery Class Reference

Class SelectDoctrineQuery. More...

Inheritance diagram for eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery:

## Public Member Functions
| select ()
| Opens the query and selects which columns you want to return with the query. More...
| alias ($name, $alias)
| Returns SQL to create an alias. More...
| selectDistinct ()
| Opens the query and uses a distinct select on the columns you want to return with the query. More...
| from ()
| Select which tables you want to select from. More...
| innerJoin ()
| Returns the SQL for an inner join or prepares $fromString for an inner join. More...
| leftJoin ()
| Returns the SQL for a left join or prepares $fromString for a left join. More...
| rightJoin ()
| Returns the SQL for a right join or prepares $fromString for a right join. More...
| where ()
| Adds a where clause with logical expressions to the query. More...
| limit ($limit, $offset='')
| Returns SQL that limits the result set. More...
| orderBy ($column, $type=self::ASC)
| Returns SQL that orders the result set by a given column. More...
| groupBy ()
| Returns SQL that groups the result set by a given column. More...
| having ()
| Returns SQL that set having by a given expression. More...
| getQuery ()
| Returns the query string for this query object. More...
Public Member Functions inherited from eZ\Publish\Core\Persistence\Doctrine\AbstractDoctrineQuery
| __construct (Connection $connection)
| subSelect ()
| Create a subselect used with the current query. More...
| prepare ()
| bindValue ($value, $placeHolder=null, $type=PDO::PARAM_STR)
| Binds the value $value to the specified variable name $placeHolder. More...
| bindParam (&$param, $placeHolder=null, $type=PDO::PARAM_STR)
| Binds the parameter $param to the specified variable name $placeHolder. More...
| __toString ()
| Return the SQL string for this query. More...
Public Member Functions inherited from eZ\Publish\Core\Persistence\Database\Query
| subSelect ()
| Create a subselect used with the current query. More...
| prepare ()
| bindValue ($value, $placeHolder=null, $type=PDO::PARAM_STR)
| Binds the value $value to the specified variable name $placeHolder. More...
| bindParam (&$param, $placeHolder=null, $type=PDO::PARAM_STR)
| Binds the parameter $param to the specified variable name $placeHolder. More...
| __toString ()
| Return the SQL string for this query. More...

## Public Attributes
| $permissionSubtreeJoinAdded = false
Public Attributes inherited from eZ\Publish\Core\Persistence\Doctrine\AbstractDoctrineQuery
| $expr
Public Attributes inherited from eZ\Publish\Core\Persistence\Database\SelectQuery
const | ASC = 'ASC'
const | DESC = 'DESC'

## Protected Member Functions
| doJoin ($type, array $args)
| Helper function to generate join. More...
Protected Member Functions inherited from eZ\Publish\Core\Persistence\Doctrine\AbstractDoctrineQuery
| parseArguments (array $args)
| Parse the arguments and validate for existance of values. More...

## Private Attributes
| $parts
| $distinct = false
| $limit
| $offset

## Additional Inherited Members
Protected Attributes inherited from eZ\Publish\Core\Persistence\Doctrine\AbstractDoctrineQuery
| $connection

## Detailed Description

Class SelectDoctrineQuery.

Deprecated:
  Since 6.13, please use Doctrine DBAL instead (@ezpublish.persistence.connection) it provides richer and more powerful DB abstraction which is also easier to use.

Definition at line 18 of file SelectDoctrineQuery.php.

## Member Function Documentation

## ◆ alias()

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::alias | ( |  | $name,
|  |  | $alias
| ) |  |

Returns SQL to create an 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' ) );`

Parameters

  string | $name |
  string | $alias |

Returns
  string the query string "columnname as targetname"

Implements eZ\Publish\Core\Persistence\Database\SelectQuery.

Definition at line 113 of file SelectDoctrineQuery.php.

## ◆ doJoin()

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::doJoin | ( |  | $type,
|  | array | $args
| ) |  |
| protected

Helper function to generate join.

Parameters

  string | $type |
  array | $args |

Returns
  \eZ\Publish\Core\Persistence\Database\SelectQuery

Definition at line 263 of file SelectDoctrineQuery.php.

Referenced by eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery\innerJoin(), eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery\leftJoin(), and eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery\rightJoin().

## ◆ from()

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::from | ( |  | ) |

Select which tables you want to select 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' );`

Exceptions

Implements eZ\Publish\Core\Persistence\Database\SelectQuery.

Definition at line 185 of file SelectDoctrineQuery.php.

References eZ\Publish\Core\Persistence\Doctrine\AbstractDoctrineQuery\parseArguments().

## ◆ getQuery()

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::getQuery | ( |  | ) |

Returns the query string for this query object.

Exceptions

Implements eZ\Publish\Core\Persistence\Database\Query.

Reimplemented in eZ\Publish\Core\Persistence\Doctrine\SubselectDoctrineQuery.

Definition at line 565 of file SelectDoctrineQuery.php.

References eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery\limit().

## ◆ groupBy()

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::groupBy | ( |  | ) |

Returns SQL that groups the result set by a given column.

You can call groupBy multiple times. Each call will add a column to group by.

Example: `$q->select( '*' )->from( 'table' ) ->groupBy( 'id' );`

Exceptions

Implements eZ\Publish\Core\Persistence\Database\SelectQuery.

Definition at line 512 of file SelectDoctrineQuery.php.

References eZ\Publish\Core\Persistence\Doctrine\AbstractDoctrineQuery\parseArguments().

## ◆ having()

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::having | ( |  | ) |

Returns SQL that set having by a given expression.

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) );`

Exceptions

Implements eZ\Publish\Core\Persistence\Database\SelectQuery.

Definition at line 543 of file SelectDoctrineQuery.php.

## ◆ innerJoin()

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::innerJoin | ( |  | ) |

Returns the SQL for an inner join or prepares $fromString for an inner join.

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' );`

Exceptions

Implements eZ\Publish\Core\Persistence\Database\SelectQuery.

Definition at line 250 of file SelectDoctrineQuery.php.

References eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery\doJoin().

## ◆ leftJoin()

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::leftJoin | ( |  | ) |

Returns the SQL for a left join or prepares $fromString for a left join.

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' );`

Exceptions

Implements eZ\Publish\Core\Persistence\Database\SelectQuery.

Definition at line 338 of file SelectDoctrineQuery.php.

References eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery\doJoin().

## ◆ limit()

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::limit | ( |  | $limit,
|  |  | $offset = `''`
| ) |  |

Returns SQL that limits the result set.

$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.

Parameters

  string | $limit | integer expression
  string | $offset | integer expression

Returns
  \eZ\Publish\Core\Persistence\Database\SelectQuery

Implements eZ\Publish\Core\Persistence\Database\SelectQuery.

Definition at line 458 of file SelectDoctrineQuery.php.

References eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery\$limit, and eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery\$offset.

Referenced by eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery\getQuery().

## ◆ orderBy()

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::orderBy | ( |  | $column,
|  |  | $type = `self::ASC`
| ) |  |

Returns SQL that orders the result set by a given column.

You can call orderBy multiple times. Each call will add a column to order by.

Example: `$q->select( '*' )->from( 'table' ) ->orderBy( 'id' );`

Parameters

  string | $column | a column name in the result set
  string | $type | 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

Returns
  \eZ\Publish\Core\Persistence\Database\SelectQuery a pointer to $this

Implements eZ\Publish\Core\Persistence\Database\SelectQuery.

Definition at line 483 of file SelectDoctrineQuery.php.

## ◆ rightJoin()

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::rightJoin | ( |  | ) |

Returns the SQL for a right join or prepares $fromString for a right join.

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' );`

Exceptions

Implements eZ\Publish\Core\Persistence\Database\SelectQuery.

Definition at line 394 of file SelectDoctrineQuery.php.

References eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery\doJoin().

## ◆ select()

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::select | ( |  | ) |

Opens the query and selects which columns you want to return with the query.

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.

Exceptions

Implements eZ\Publish\Core\Persistence\Database\SelectQuery.

Definition at line 84 of file SelectDoctrineQuery.php.

References eZ\Publish\Core\Persistence\Doctrine\AbstractDoctrineQuery\parseArguments().

## ◆ selectDistinct()

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::selectDistinct | ( |  | ) |

Opens the query and uses a distinct select on the columns you want to return with the query.

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.

Exceptions

Implements eZ\Publish\Core\Persistence\Database\SelectQuery.

Definition at line 156 of file SelectDoctrineQuery.php.

## ◆ where()

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::where | ( |  | ) |

Adds a where clause with logical expressions to the query.

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 ) );`

Exceptions

Implements eZ\Publish\Core\Persistence\Database\SelectQuery.

Definition at line 421 of file SelectDoctrineQuery.php.

## Member Data Documentation

## ◆ $distinct

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::$distinct = false
| private

Definition at line 30 of file SelectDoctrineQuery.php.

## ◆ $limit

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::$limit
| private

Definition at line 33 of file SelectDoctrineQuery.php.

Referenced by eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery\limit().

## ◆ $offset

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::$offset
| private

Definition at line 36 of file SelectDoctrineQuery.php.

Referenced by eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery\limit().

## ◆ $parts

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::$parts
| private

Initial value:
= [
'select' => [],
'from' => [],
'where' => [],
'orderBy' => [],
'groupBy' => [],
'having' => [],
]

Definition at line 20 of file SelectDoctrineQuery.php.

## ◆ $permissionSubtreeJoinAdded

eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery::$permissionSubtreeJoinAdded = false

Definition at line 49 of file SelectDoctrineQuery.php.

The documentation for this class was generated from the following file:

- SelectDoctrineQuery.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.