Class CommonTableExpression
An expression that represents a common table expression definition.
Properties summary
- $fields protected
\Cake\Database\Expression\IdentifierExpression[]
The field names to use for the CTE.
- $materialized protected
string|null
Whether the CTE is materialized or not materialized.
- $name protected
\Cake\Database\Expression\IdentifierExpression
The CTE name.
- $query protected
\Cake\Database\ExpressionInterface|null
The CTE query definition.
- $recursive protected
bool
Whether the CTE is recursive.
Method Summary
- traverse() public
Iterates over each part of the expression recursively for every level of the expressions tree and executes the $visitor callable passing as first parameter the instance of the expression currently being iterated.
Method Detail
__clone() public
__clone()
Clones the inner expression objects.
__construct() public
__construct(string $name, mixed $query)
Constructor.
Parameters
-
string
$name optional The CTE name.
-
\Closure|\Cake\Database\ExpressionInterface
$query optional CTE query
field() public
field(mixed $fields)
Adds one or more fields (arguments) to the CTE.
Parameters
-
string|string[]|\Cake\Database\Expression\IdentifierExpression|\Cake\Database\Expression\IdentifierExpression[]
$fields Field names
Returns
$this
isRecursive() public
isRecursive()
Gets whether this CTE is recursive.
Returns
bool
materialized() public
materialized()
Sets this CTE as materialized.
Returns
$this
name() public
name(string $name)
Sets the name of this CTE.
This is the named you used to reference the expression in select, insert, etc queries.
Parameters
-
string
$name The CTE name.
Returns
$this
notMaterialized() public
notMaterialized()
Sets this CTE as not materialized.
Returns
$this
query() public
query(mixed $query)
Sets the query for this CTE.
Parameters
-
\Closure|\Cake\Database\ExpressionInterface
$query CTE query
Returns
$this
recursive() public
recursive()
Sets this CTE as recursive.
Returns
$this
sql() public
sql(\Cake\Database\ValueBinder $generator)
Converts the Node into a SQL string fragment.
Parameters
-
\Cake\Database\ValueBinder
$generator Placeholder generator object
Returns
string
traverse() public
traverse(\Closure $visitor)
Iterates over each part of the expression recursively for every level of the expressions tree and executes the $visitor callable passing as first parameter the instance of the expression currently being iterated.
Parameters
-
\Closure
$visitor The callable to apply to all nodes.
Returns
$this
Property Detail
$fields protected
The field names to use for the CTE.
Type
\Cake\Database\Expression\IdentifierExpression[]
$materialized protected
Whether the CTE is materialized or not materialized.
Type
string|null
$name protected
The CTE name.
Type
\Cake\Database\Expression\IdentifierExpression
$query protected
The CTE query definition.
Type
\Cake\Database\ExpressionInterface|null
$recursive protected
Whether the CTE is recursive.
Type
bool
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.1/class-Cake.Database.Expression.CommonTableExpression.html