Class CommonTableExpression
An expression that represents a common table expression definition.
Property Summary
- $fields protected
arrayCake\Database\Expression\IdentifierExpression>The field names to use for the CTE.
- $materialized protected
string|nullWhether the CTE is materialized or not materialized.
- $name protected
Cake\Database\Expression\IdentifierExpressionThe CTE name.
- $query protected
Cake\Database\ExpressionInterface|nullThe CTE query definition.
- $recursive protected
boolWhether the CTE is recursive.
Method Summary
-
__clone() public
Clones the inner expression objects.
-
__construct() public
Constructor.
-
field() public
Adds one or more fields (arguments) to the CTE.
-
isRecursive() public
Gets whether this CTE is recursive.
-
materialized() public
Sets this CTE as materialized.
-
name() public
Sets the name of this CTE.
-
notMaterialized() public
Sets this CTE as not materialized.
-
query() public
Sets the query for this CTE.
-
recursive() public
Sets this CTE as recursive.
-
sql() public
Converts the Node into a SQL string fragment.
-
traverse() public
Iterates over each part of the expression recursively for every level of the expressions tree and executes the $callback callable passing as first parameter the instance of the expression currently being iterated.
Method Detail
__clone() public
__clone(): void
Clones the inner expression objects.
Returns
void__construct() public
__construct(string $name = '', Cake\Database\ExpressionInterfaceClosure $query = null)
Constructor.
Parameters
-
string$name optional The CTE name.
-
Cake\Database\ExpressionInterfaceClosure$query optional CTE query
field() public
field(Cake\Database\Expression\IdentifierExpression|arrayCake\Database\Expression\IdentifierExpression>|array<string>|string $fields): $this
Adds one or more fields (arguments) to the CTE.
Parameters
-
Cake\Database\Expression\IdentifierExpression|arrayCake\Database\Expression\IdentifierExpression>|array<string>|string$fields Field names
Returns
$thisisRecursive() public
isRecursive(): bool
Gets whether this CTE is recursive.
Returns
boolmaterialized() public
materialized(): $this
Sets this CTE as materialized.
Returns
$thisname() public
name(string $name): $this
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
$thisnotMaterialized() public
notMaterialized(): $this
Sets this CTE as not materialized.
Returns
$thisquery() public
query(Cake\Database\ExpressionInterfaceClosure $query): $this
Sets the query for this CTE.
Parameters
-
Cake\Database\ExpressionInterfaceClosure$query CTE query
Returns
$thisrecursive() public
recursive(): $this
Sets this CTE as recursive.
Returns
$thissql() public
sql(Cake\Database\ValueBinder $binder): string
Converts the Node into a SQL string fragment.
Parameters
-
Cake\Database\ValueBinder$binder
Returns
stringtraverse() public
traverse(Closure $callback): $this
Iterates over each part of the expression recursively for every level of the expressions tree and executes the $callback callable passing as first parameter the instance of the expression currently being iterated.
Parameters
-
Closure$callback
Returns
$thisProperty Detail
$fields protected
The field names to use for the CTE.
Type
arrayCake\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.4/class-Cake.Database.Expression.CommonTableExpression.html