Class CommonTableExpression
An expression that represents a common table expression definition.
Property Summary
- 
        $fields protectedCake\Database\Expression\IdentifierExpression[]The field names to use for the CTE. 
- 
        $materialized protectedstring|nullWhether the CTE is materialized or not materialized. 
- 
        $name protectedCake\Database\Expression\IdentifierExpressionThe CTE name. 
- 
        $query protectedCake\Database\ExpressionInterface|nullThe CTE query definition. 
- 
        $recursive protectedboolWhether the CTE is recursive. 
Method Summary
- 
          __clone() publicClones the inner expression objects. 
- 
          __construct() publicConstructor. 
- 
          field() publicAdds one or more fields (arguments) to the CTE. 
- 
          isRecursive() publicGets whether this CTE is recursive. 
- 
          materialized() publicSets this CTE as materialized. 
- 
          name() publicSets the name of this CTE. 
- 
          notMaterialized() publicSets this CTE as not materialized. 
- 
          query() publicSets the query for this CTE. 
- 
          recursive() publicSets this CTE as recursive. 
- 
          sql() publicConverts the Node into a SQL string fragment. 
- 
          traverse() publicIterates 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
__construct() ¶ public
__construct(string $name = '', Closure|Cake\Database\ExpressionInterface $query = null)Constructor.
Parameters
- 
                string$name optional
- The CTE name. 
- 
                Closure|Cake\Database\ExpressionInterface$query optional
- CTE query 
field() ¶ public
field(string|string[]|Cake\Database\Expression\IdentifierExpression|Cake\Database\Expression\IdentifierExpression[] $fields): $thisAdds one or more fields (arguments) to the CTE.
Parameters
- 
                string|string[]|Cake\Database\Expression\IdentifierExpression|Cake\Database\Expression\IdentifierExpression[]$fields
- Field names 
Returns
$thisname() ¶ public
name(string $name): $thisSets 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(): $thisSets this CTE as not materialized.
Returns
$thisquery() ¶ public
query(Closure|Cake\Database\ExpressionInterface $query): $thisSets the query for this CTE.
Parameters
- 
                Closure|Cake\Database\ExpressionInterface$query
- CTE query 
Returns
$thissql() ¶ public
sql(Cake\Database\ValueBinder $binder): stringConverts the Node into a SQL string fragment.
Parameters
- 
                Cake\Database\ValueBinder$binder
Returns
stringtraverse() ¶ public
traverse(Closure $callback): $thisIterates 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
Cake\Database\Expression\IdentifierExpression[]