PHP Class eZ\Publish\Core\Persistence\Doctrine\SubselectDoctrineQuery

Inheritance: extends SelectDoctrineQuery
Datei anzeigen Open project: ezsystems/ezpublish-kernel

Protected Properties

Property Type Description
$outerQuery SelectDoctrineQuery Holds the outer query.

Public Methods

Method Description
__construct ( AbstractDoctrineQuery $outer ) Constructs a new ezcQuerySubSelect object.
bindParam ( &mixed &$param, string $placeHolder = null, $type = PDO::PARAM_STR ) : string Binds the parameter $param to the specified variable name $placeHolder.
bindValue ( mixed $value, string $placeHolder = null, $type = PDO::PARAM_STR ) : string Binds the value $value to the specified variable name $placeHolder.
getQuery ( ) : string Returns the SQL string for the subselect.
subSelect ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery Returns ezcQuerySubSelect of deeper level.

Method Details

__construct() public method

The subSelect() method of the ezcQuery object creates an object of this class, and passes itself as $outer parameter to this constructor.
public __construct ( AbstractDoctrineQuery $outer )
$outer AbstractDoctrineQuery

bindParam() public method

This method uses ezcQuery::bindParam() from the ezcQuery class in which the subSelect was called. Info about bound parameters are stored in the parent ezcQuery object that is stored in the $outer property. The parameter $param specifies the variable that you want to bind. If $placeholder is not provided bind() will automatically create a placeholder for you. An automatic placeholder will be of the name 'placeholder1', 'placeholder2' etc. Example: subSelect(); $subSelect->select('*') ->from( 'table2' ) ->where( $subSelect->expr->in( 'id', $subSelect->bindParam( $value ) ) ); $q->select( '*' ) ->from( 'table' ) ->where ( $q->expr->eq( 'id', $subSelect ) ); $stmt = $q->prepare(); // the parameter $value is bound to the query. $value = 4; $stmt->execute(); // subselect executed with 'id = 4' ?>
See also: ezcQuery::bindParam()
public bindParam ( &mixed &$param, string $placeHolder = null, $type = PDO::PARAM_STR ) : string
$param &mixed
$placeHolder string the name to bind with. The string must start with a colon ':'.
return string the placeholder name used.

bindValue() public method

This method uses ezcQuery::bindParam() from the ezcQuery class in which the subSelect was called. Info about bound parameters are stored in the parent ezcQuery object that is stored in the $outer property. The parameter $value specifies the value that you want to bind. If $placeholder is not provided bindValue() will automatically create a placeholder for you. An automatic placeholder will be of the name 'placeholder1', 'placeholder2' etc. Example: subSelect(); $subSelect->select( name ) ->from( 'table2' ) ->where( $subSelect->expr->in( 'id', $subSelect->bindValue( $value ) ) ); $q->select( '*' ) ->from( 'table1' ) ->where ( $q->expr->eq( 'name', $subSelect ) ); $stmt = $q->prepare(); // the $value is bound to the query. $value = 4; $stmt->execute(); // subselect executed with 'id = 2' ?>
See also: ezcQuery::bindValue()
public bindValue ( mixed $value, string $placeHolder = null, $type = PDO::PARAM_STR ) : string
$value mixed
$placeHolder string the name to bind with. The string must start with a colon ':'.
return string the placeholder name used.

getQuery() public method

Example: subSelect(); $subSelect->select( name )->from( 'table2' ); $q->select( '*' ) ->from( 'table1' ) ->where ( $q->expr->eq( 'name', $subSelect ) ); $stmt = $q->prepare(); $stmt->execute(); ?>
public getQuery ( ) : string
return string

subSelect() public method

Used for making subselects inside subselects. Example: subSelect(); $subSelect->select( name ) ->from( 'table2' ) ->where( $subSelect->expr->in( 'id', $subSelect->bindValue( $value ) ) ); $q->select( '*' ) ->from( 'table1' ) ->where ( $q->expr->eq( 'name', $subSelect ) ); $stmt = $q->prepare(); // the $value is bound to the query. $value = 4; $stmt->execute(); // subselect executed with 'id = 2' ?>
public subSelect ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery
return eZ\Publish\Core\Persistence\Database\SelectQuery

Property Details

$outerQuery protected_oe property

Holds the outer query.
protected SelectDoctrineQuery,eZ\Publish\Core\Persistence\Doctrine $outerQuery
return SelectDoctrineQuery