Class AggregateExpression
This represents a SQL aggregate function expression in a SQL statement. Calls can be constructed by passing the name of the function and a list of params. For security reasons, all params passed are quoted by default unless explicitly told otherwise.
Constants
Property Summary
- 
        $_conditions protectedarrayA list of strings or other expression objects that represent the "branches" of the expression tree. For example one key of the array might look like "sum > :value" 
- 
        $_conjunction protectedstringString to be used for joining each of the internal expressions this object internally stores for example "AND", "OR", etc. 
- 
        $_name protectedstringThe name of the function to be constructed when generating the SQL string 
- 
        $_returnType protectedstringThe type name this expression will return when executed 
- 
        $_typeMap protectedCake\Database\TypeMap|null
- 
        $filter protectedCake\Database\Expression\QueryExpression
- 
        $window protectedCake\Database\Expression\WindowExpression
Method Summary
- 
          __clone() publicClone this object and its subtree of expressions. 
- 
          __construct() publicConstructor. Takes a name for the function to be invoked and a list of params to be passed into the function. Optionally you can pass a list of types to be used for each bound param. 
- 
          _addConditions() protectedAuxiliary function used for decomposing a nested array of conditions and build a tree structure inside this object to represent the full SQL expression. String conditions are stored directly in the conditions, while any other representation is wrapped around an adequate instance or of this class. 
- 
          _calculateType() protectedReturns the type name for the passed field if it was stored in the typeMap 
- 
          _castToExpression() protectedConditionally converts the passed value to an ExpressionInterface object if the type class implements the ExpressionTypeInterface. Otherwise, returns the value unmodified. 
- 
          _parseCondition() protectedParses a string conditions by trying to extract the operator inside it if any and finally returning either an adequate QueryExpression object or a plain string representation of the condition. This function is responsible for generating the placeholders and replacing the values by them, while storing the value elsewhere for future binding. 
- 
          _requiresToExpressionCasting() protectedReturns an array with the types that require values to be casted to expressions, out of the list of type names passed as parameter. 
- 
          add() publicAdds one or more arguments for the function call. 
- 
          addCase() publicAdds a new case expression to the expression object 
- 
          and() publicReturns a new QueryExpression object containing all the conditions passed and set up the conjunction to be "AND" 
- 
          and_() public deprecatedReturns a new QueryExpression object containing all the conditions passed and set up the conjunction to be "AND" 
- 
          between() publicAdds a new condition to the expression object in the form "field BETWEEN from AND to". 
- 
          count() publicThe name of the function is in itself an expression to generate, thus always adding 1 to the amount of expressions stored in this object. 
- 
          eq() publicAdds a new condition to the expression object in the form "field = value". 
- 
          equalFields() publicBuilds equal condition or assignment with identifier wrapping. 
- 
          excludeCurrent() publicAdds current row frame exclusion. 
- 
          excludeGroup() publicAdds group frame exclusion. 
- 
          excludeTies() publicAdds ties frame exclusion. 
- 
          exists() publicAdds a new condition to the expression object in the form "EXISTS (...)". 
- 
          filter() publicAdds conditions to the FILTER clause. The conditions are the same format as Query::where().
- 
          frame() publicAdds a frame to the window. 
- 
          getConjunction() publicGets the currently configured conjunction for the conditions at this level of the expression tree. 
- 
          getDefaultTypes() publicGets default types of current type map. 
- 
          getName() publicGets the name of the SQL function to be invoke in this expression. 
- 
          getReturnType() publicGets the type of the value this object will generate. 
- 
          getTypeMap() publicReturns the existing type map. 
- 
          groups() publicAdds a simple groups frame to the window. 
- 
          gt() publicAdds a new condition to the expression object in the form "field > value". 
- 
          gte() publicAdds a new condition to the expression object in the form "field >= value". 
- 
          hasNestedExpression() publicReturns true if this expression contains any other nested ExpressionInterface objects 
- 
          in() publicAdds a new condition to the expression object in the form "field IN (value1, value2)". 
- 
          isCallable() public deprecatedCheck whether or not a callable is acceptable. 
- 
          isNotNull() publicAdds a new condition to the expression object in the form "field IS NOT NULL". 
- 
          isNull() publicAdds a new condition to the expression object in the form "field IS NULL". 
- 
          iterateParts() publicExecutes a callable function for each of the parts that form this expression. 
- 
          like() publicAdds a new condition to the expression object in the form "field LIKE value". 
- 
          lt() publicAdds a new condition to the expression object in the form "field < value". 
- 
          lte() publicAdds a new condition to the expression object in the form "field <= value". 
- 
          not() publicAdds a new set of conditions to this level of the tree and negates the final result by prepending a NOT, it will look like "NOT ( (condition1) AND (conditions2) )" conjunction depends on the one currently configured for this object. 
- 
          notEq() publicAdds a new condition to the expression object in the form "field != value". 
- 
          notExists() publicAdds a new condition to the expression object in the form "NOT EXISTS (...)". 
- 
          notIn() publicAdds a new condition to the expression object in the form "field NOT IN (value1, value2)". 
- 
          notLike() publicAdds a new condition to the expression object in the form "field NOT LIKE value". 
- 
          or() publicReturns a new QueryExpression object containing all the conditions passed and set up the conjunction to be "OR" 
- 
          or_() public deprecatedReturns a new QueryExpression object containing all the conditions passed and set up the conjunction to be "OR" 
- 
          order() publicAdds one or more order clauses to the window. 
- 
          over() publicAdds an empty OVER()window expression or a named window epression.
- 
          partition() publicAdds one or more partition expressions to the window. 
- 
          range() publicAdds a simple range frame to the window. 
- 
          rows() publicAdds a simple rows frame to the window. 
- 
          setConjunction() publicChanges the conjunction for the conditions at this level of the expression tree. 
- 
          setDefaultTypes() publicOverwrite the default type mappings for fields in the implementing object. 
- 
          setName() publicSets the name of the SQL function to be invoke in this expression. 
- 
          setReturnType() publicSets the type of the value this object will generate. 
- 
          setTypeMap() publicCreates a new TypeMap if $typeMap is an array, otherwise exchanges it for the given one. 
- 
          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, array $params = [], array $types = [], string $returnType = 'string')Constructor. Takes a name for the function to be invoked and a list of params to be passed into the function. Optionally you can pass a list of types to be used for each bound param.
By default, all params that are passed will be quoted. If you wish to use literal arguments, you need to explicitly hint this function.
Examples:
$f = new FunctionExpression('CONCAT', ['CakePHP', ' rules']);
Previous line will generate CONCAT('CakePHP', ' rules')
$f = new FunctionExpression('CONCAT', ['name' => 'literal', ' rules']);
Will produce CONCAT(name, ' rules')
Parameters
- 
                string$name
- the name of the function to be constructed 
- 
                array$params optional
- list of arguments to be passed to the function If associative the key would be used as argument when value is 'literal' 
- 
                array$types optional
- associative array of types to be associated with the passed arguments 
- 
                string$returnType optional
- The return type of this expression 
_addConditions() ¶ protected
_addConditions(array $conditions, array $types): voidAuxiliary function used for decomposing a nested array of conditions and build a tree structure inside this object to represent the full SQL expression. String conditions are stored directly in the conditions, while any other representation is wrapped around an adequate instance or of this class.
Parameters
- 
                array$conditions
- list of conditions to be stored in this object 
- 
                array$types
- list of types associated on fields referenced in $conditions 
Returns
void_calculateType() ¶ protected
_calculateType(string|Cake\Database\ExpressionInterface $field): string|nullReturns the type name for the passed field if it was stored in the typeMap
Parameters
- 
                string|Cake\Database\ExpressionInterface$field
- The field name to get a type for. 
Returns
string|nullThe computed type or null, if the type is unknown.
_castToExpression() ¶ protected
_castToExpression(mixed $value, string|null $type = null): mixedConditionally converts the passed value to an ExpressionInterface object if the type class implements the ExpressionTypeInterface. Otherwise, returns the value unmodified.
Parameters
- 
                mixed$value
- The value to convert to ExpressionInterface 
- 
                string|null$type optional
- The type name 
Returns
mixed_parseCondition() ¶ protected
_parseCondition(string $field, mixed $value): string|Cake\Database\ExpressionInterfaceParses a string conditions by trying to extract the operator inside it if any and finally returning either an adequate QueryExpression object or a plain string representation of the condition. This function is responsible for generating the placeholders and replacing the values by them, while storing the value elsewhere for future binding.
Parameters
- 
                string$field
- The value from which the actual field and operator will be extracted. 
- 
                mixed$value
- The value to be bound to a placeholder for the field 
Returns
string|Cake\Database\ExpressionInterfaceThrows
InvalidArgumentExceptionIf operator is invalid or missing on NULL usage.
_requiresToExpressionCasting() ¶ protected
_requiresToExpressionCasting(array $types): arrayReturns an array with the types that require values to be casted to expressions, out of the list of type names passed as parameter.
Parameters
- 
                array$types
- List of type names 
Returns
arrayadd() ¶ public
add(array $conditions, array $types = [], bool $prepend = false): $thisAdds one or more arguments for the function call.
Parameters
- 
                array$conditions
- list of arguments to be passed to the function If associative the key would be used as argument when value is 'literal' 
- 
                array$types optional
- associative array of types to be associated with the passed arguments 
- 
                bool$prepend optional
- Whether to prepend or append to the list of arguments 
Returns
$thisSee Also
addCase() ¶ public
addCase(array|Cake\Database\ExpressionInterface $conditions, array|Cake\Database\ExpressionInterface $values = [], array $types = []): $thisAdds a new case expression to the expression object
Parameters
- 
                array|Cake\Database\ExpressionInterface$conditions
- The conditions to test. Must be a ExpressionInterface instance, or an array of ExpressionInterface instances. 
- 
                array|Cake\Database\ExpressionInterface$values optional
- associative array of values to be associated with the conditions passed in $conditions. If there are more $values than $conditions, the last $value is used as the - ELSEvalue.
- 
                array$types optional
- associative array of types to be associated with the values passed in $values 
Returns
$thisand() ¶ public
and(Closure|string|array|Cake\Database\ExpressionInterface $conditions, array $types = []): Cake\Database\Expression\QueryExpressionReturns a new QueryExpression object containing all the conditions passed and set up the conjunction to be "AND"
Parameters
- 
                Closure|string|array|Cake\Database\ExpressionInterface$conditions
- to be joined with AND 
- 
                array$types optional
- associative array of fields pointing to the type of the values that are being passed. Used for correctly binding values to statements. 
Returns
Cake\Database\Expression\QueryExpressionand_() ¶ public
and_(Closure|string|array|Cake\Database\ExpressionInterface $conditions, array $types = []): Cake\Database\Expression\QueryExpressionReturns a new QueryExpression object containing all the conditions passed and set up the conjunction to be "AND"
Parameters
- 
                Closure|string|array|Cake\Database\ExpressionInterface$conditions
- to be joined with AND 
- 
                array$types optional
- associative array of fields pointing to the type of the values that are being passed. Used for correctly binding values to statements. 
Returns
Cake\Database\Expression\QueryExpressionbetween() ¶ public
between(string|Cake\Database\ExpressionInterface $field, mixed $from, mixed $to, string|null $type = null): $thisAdds a new condition to the expression object in the form "field BETWEEN from AND to".
Parameters
- 
                string|Cake\Database\ExpressionInterface$field
- The field name to compare for values inbetween the range. 
- 
                mixed$from
- The initial value of the range. 
- 
                mixed$to
- The ending value in the comparison range. 
- 
                string|null$type optional
- the type name for $value as configured using the Type map. 
Returns
$thiscount() ¶ public
count(): intThe name of the function is in itself an expression to generate, thus always adding 1 to the amount of expressions stored in this object.
Returns
inteq() ¶ public
eq(string|Cake\Database\ExpressionInterface $field, mixed $value, string|null $type = null): $thisAdds a new condition to the expression object in the form "field = value".
Parameters
- 
                string|Cake\Database\ExpressionInterface$field
- Database field to be compared against value 
- 
                mixed$value
- The value to be bound to $field for comparison 
- 
                string|null$type optional
- the type name for $value as configured using the Type map. If it is suffixed with "[]" and the value is an array then multiple placeholders will be created, one per each value in the array. 
Returns
$thisequalFields() ¶ public
equalFields(string $leftField, string $rightField): $thisBuilds equal condition or assignment with identifier wrapping.
Parameters
- 
                string$leftField
- Left join condition field name. 
- 
                string$rightField
- Right join condition field name. 
Returns
$thisexists() ¶ public
exists(Cake\Database\ExpressionInterface $expression): $thisAdds a new condition to the expression object in the form "EXISTS (...)".
Parameters
- 
                Cake\Database\ExpressionInterface$expression
- the inner query 
Returns
$thisfilter() ¶ public
filter(string|array|Cake\Database\ExpressionInterface|Closure $conditions, array $types = []): $thisAdds conditions to the FILTER clause. The conditions are the same format as
Query::where().
Parameters
- 
                string|array|Cake\Database\ExpressionInterface|Closure$conditions
- The conditions to filter on. 
- 
                array$types optional
- associative array of type names used to bind values to query 
Returns
$thisSee Also
frame() ¶ public
frame(string $type, int|string|Cake\Database\ExpressionInterface|null $startOffset, string $startDirection, int|string|Cake\Database\ExpressionInterface|null $endOffset, string $endDirection): $thisAdds a frame to the window.
Use the range(), rows() or groups() helpers if you need simple
'BETWEEN offset PRECEDING and offset FOLLOWING' frames.
You can specify any direction for both frame start and frame end.
With both $startOffset and $endOffset:
- 0- 'CURRENT ROW'
- null- 'UNBOUNDED'
Parameters
- 
                string$type
- 
                int|string|Cake\Database\ExpressionInterface|null$startOffset
- 
                string$startDirection
- 
                int|string|Cake\Database\ExpressionInterface|null$endOffset
- 
                string$endDirection
Returns
$thisgetConjunction() ¶ public
getConjunction(): stringGets the currently configured conjunction for the conditions at this level of the expression tree.
Returns
stringgetDefaultTypes() ¶ public
getDefaultTypes(): arrayGets default types of current type map.
Returns
arraygetName() ¶ public
getName(): stringGets the name of the SQL function to be invoke in this expression.
Returns
stringgetReturnType() ¶ public
getReturnType(): stringGets the type of the value this object will generate.
Returns
stringgetTypeMap() ¶ public
getTypeMap(): Cake\Database\TypeMapReturns the existing type map.
Returns
Cake\Database\TypeMapgroups() ¶ public
groups(int|null $start, int|null $end = 0): $thisAdds a simple groups frame to the window.
See range() for details.
Parameters
- 
                int|null$start
- 
                int|null$end optional
Returns
$thisgt() ¶ public
gt(string|Cake\Database\ExpressionInterface $field, mixed $value, string|null $type = null): $thisAdds a new condition to the expression object in the form "field > value".
Parameters
- 
                string|Cake\Database\ExpressionInterface$field
- Database field to be compared against value 
- 
                mixed$value
- The value to be bound to $field for comparison 
- 
                string|null$type optional
- the type name for $value as configured using the Type map. 
Returns
$thisgte() ¶ public
gte(string|Cake\Database\ExpressionInterface $field, mixed $value, string|null $type = null): $thisAdds a new condition to the expression object in the form "field >= value".
Parameters
- 
                string|Cake\Database\ExpressionInterface$field
- Database field to be compared against value 
- 
                mixed$value
- The value to be bound to $field for comparison 
- 
                string|null$type optional
- the type name for $value as configured using the Type map. 
Returns
$thishasNestedExpression() ¶ public
hasNestedExpression(): boolReturns true if this expression contains any other nested ExpressionInterface objects
Returns
boolin() ¶ public
in(string|Cake\Database\ExpressionInterface $field, string|array|Cake\Database\ExpressionInterface $values, string|null $type = null): $thisAdds a new condition to the expression object in the form "field IN (value1, value2)".
Parameters
- 
                string|Cake\Database\ExpressionInterface$field
- Database field to be compared against value 
- 
                string|array|Cake\Database\ExpressionInterface$values
- the value to be bound to $field for comparison 
- 
                string|null$type optional
- the type name for $value as configured using the Type map. 
Returns
$thisisCallable() ¶ public
isCallable(callable|string|array|Cake\Database\ExpressionInterface $callable): boolCheck whether or not a callable is acceptable.
We don't accept ['class', 'method'] style callbacks, as they often contain user input and arrays of strings are easy to sneak in.
Parameters
- 
                callable|string|array|Cake\Database\ExpressionInterface$callable
- The callable to check. 
Returns
boolValid callable.
isNotNull() ¶ public
isNotNull(string|Cake\Database\ExpressionInterface $field): $thisAdds a new condition to the expression object in the form "field IS NOT NULL".
Parameters
- 
                string|Cake\Database\ExpressionInterface$field
- database field to be tested for not null 
Returns
$thisisNull() ¶ public
isNull(string|Cake\Database\ExpressionInterface $field): $thisAdds a new condition to the expression object in the form "field IS NULL".
Parameters
- 
                string|Cake\Database\ExpressionInterface$field
- database field to be tested for null 
Returns
$thisiterateParts() ¶ public
iterateParts(callable $callback): $thisExecutes a callable function for each of the parts that form this expression.
The callable function is required to return a value with which the currently visited part will be replaced. If the callable function returns null then the part will be discarded completely from this expression.
The callback function will receive each of the conditions as first param and the key as second param. It is possible to declare the second parameter as passed by reference, this will enable you to change the key under which the modified part is stored.
Parameters
- 
                callable$callback
- The callable to apply to each part. 
Returns
$thislike() ¶ public
like(string|Cake\Database\ExpressionInterface $field, mixed $value, string|null $type = null): $thisAdds a new condition to the expression object in the form "field LIKE value".
Parameters
- 
                string|Cake\Database\ExpressionInterface$field
- Database field to be compared against value 
- 
                mixed$value
- The value to be bound to $field for comparison 
- 
                string|null$type optional
- the type name for $value as configured using the Type map. 
Returns
$thislt() ¶ public
lt(string|Cake\Database\ExpressionInterface $field, mixed $value, string|null $type = null): $thisAdds a new condition to the expression object in the form "field < value".
Parameters
- 
                string|Cake\Database\ExpressionInterface$field
- Database field to be compared against value 
- 
                mixed$value
- The value to be bound to $field for comparison 
- 
                string|null$type optional
- the type name for $value as configured using the Type map. 
Returns
$thislte() ¶ public
lte(string|Cake\Database\ExpressionInterface $field, mixed $value, string|null $type = null): $thisAdds a new condition to the expression object in the form "field <= value".
Parameters
- 
                string|Cake\Database\ExpressionInterface$field
- Database field to be compared against value 
- 
                mixed$value
- The value to be bound to $field for comparison 
- 
                string|null$type optional
- the type name for $value as configured using the Type map. 
Returns
$thisnot() ¶ public
not(string|array|Closure|Cake\Database\ExpressionInterface $conditions, array $types = []): $thisAdds a new set of conditions to this level of the tree and negates the final result by prepending a NOT, it will look like "NOT ( (condition1) AND (conditions2) )" conjunction depends on the one currently configured for this object.
Parameters
- 
                string|array|Closure|Cake\Database\ExpressionInterface$conditions
- to be added and negated 
- 
                array$types optional
- associative array of fields pointing to the type of the values that are being passed. Used for correctly binding values to statements. 
Returns
$thisnotEq() ¶ public
notEq(string|Cake\Database\ExpressionInterface $field, mixed $value, string|null $type = null): $thisAdds a new condition to the expression object in the form "field != value".
Parameters
- 
                string|Cake\Database\ExpressionInterface$field
- Database field to be compared against value 
- 
                mixed$value
- The value to be bound to $field for comparison 
- 
                string|null$type optional
- the type name for $value as configured using the Type map. If it is suffixed with "[]" and the value is an array then multiple placeholders will be created, one per each value in the array. 
Returns
$thisnotExists() ¶ public
notExists(Cake\Database\ExpressionInterface $expression): $thisAdds a new condition to the expression object in the form "NOT EXISTS (...)".
Parameters
- 
                Cake\Database\ExpressionInterface$expression
- the inner query 
Returns
$thisnotIn() ¶ public
notIn(string|Cake\Database\ExpressionInterface $field, string|array|Cake\Database\ExpressionInterface $values, string|null $type = null): $thisAdds a new condition to the expression object in the form "field NOT IN (value1, value2)".
Parameters
- 
                string|Cake\Database\ExpressionInterface$field
- Database field to be compared against value 
- 
                string|array|Cake\Database\ExpressionInterface$values
- the value to be bound to $field for comparison 
- 
                string|null$type optional
- the type name for $value as configured using the Type map. 
Returns
$thisnotLike() ¶ public
notLike(string|Cake\Database\ExpressionInterface $field, mixed $value, string|null $type = null): $thisAdds a new condition to the expression object in the form "field NOT LIKE value".
Parameters
- 
                string|Cake\Database\ExpressionInterface$field
- Database field to be compared against value 
- 
                mixed$value
- The value to be bound to $field for comparison 
- 
                string|null$type optional
- the type name for $value as configured using the Type map. 
Returns
$thisor() ¶ public
or(Closure|string|array|Cake\Database\ExpressionInterface $conditions, array $types = []): Cake\Database\Expression\QueryExpressionReturns a new QueryExpression object containing all the conditions passed and set up the conjunction to be "OR"
Parameters
- 
                Closure|string|array|Cake\Database\ExpressionInterface$conditions
- to be joined with OR 
- 
                array$types optional
- associative array of fields pointing to the type of the values that are being passed. Used for correctly binding values to statements. 
Returns
Cake\Database\Expression\QueryExpressionor_() ¶ public
or_(Closure|string|array|Cake\Database\ExpressionInterface $conditions, array $types = []): Cake\Database\Expression\QueryExpressionReturns a new QueryExpression object containing all the conditions passed and set up the conjunction to be "OR"
Parameters
- 
                Closure|string|array|Cake\Database\ExpressionInterface$conditions
- to be joined with OR 
- 
                array$types optional
- associative array of fields pointing to the type of the values that are being passed. Used for correctly binding values to statements. 
Returns
Cake\Database\Expression\QueryExpressionorder() ¶ public
order(Closure|(Cake\Database\ExpressionInterface|string)[]|Cake\Database\ExpressionInterface|string $fields): $thisAdds one or more order clauses to the window.
Parameters
- 
                Closure|(Cake\Database\ExpressionInterface|string)[]|Cake\Database\ExpressionInterface|string$fields
Returns
$thisover() ¶ public
over(string|null $name = null): $thisAdds an empty OVER() window expression or a named window epression.
Parameters
- 
                string|null$name optional
- Window name 
Returns
$thispartition() ¶ public
partition(Closure|(Cake\Database\ExpressionInterface|string)[]|Cake\Database\ExpressionInterface|string $partitions): $thisAdds one or more partition expressions to the window.
Parameters
- 
                Closure|(Cake\Database\ExpressionInterface|string)[]|Cake\Database\ExpressionInterface|string$partitions
Returns
$thisrange() ¶ public
range(int|string|Cake\Database\ExpressionInterface|null $start, int|string|Cake\Database\ExpressionInterface|null $end = 0): $thisAdds a simple range frame to the window.
$start:
- 0- 'CURRENT ROW'
- null- 'UNBOUNDED PRECEDING'
- offset - 'offset PRECEDING'
$end:
- 0- 'CURRENT ROW'
- null- 'UNBOUNDED FOLLOWING'
- offset - 'offset FOLLOWING'
If you need to use 'FOLLOWING' with frame start or
'PRECEDING' with frame end, use frame() instead.
Parameters
- 
                int|string|Cake\Database\ExpressionInterface|null$start
- 
                int|string|Cake\Database\ExpressionInterface|null$end optional
Returns
$thisrows() ¶ public
rows(int|null $start, int|null $end = 0): $thisAdds a simple rows frame to the window.
See range() for details.
Parameters
- 
                int|null$start
- 
                int|null$end optional
Returns
$thissetConjunction() ¶ public
setConjunction(string $conjunction): $thisChanges the conjunction for the conditions at this level of the expression tree.
Parameters
- 
                string$conjunction
- Value to be used for joining conditions 
Returns
$thissetDefaultTypes() ¶ public
setDefaultTypes(array $types): $thisOverwrite the default type mappings for fields in the implementing object.
This method is useful if you need to set type mappings that are shared across multiple functions/expressions in a query.
To add a default without overwriting existing ones
use getTypeMap()->addDefaults()
Parameters
- 
                array$types
- The array of types to set. 
Returns
$thisSee Also
setName() ¶ public
setName(string $name): $thisSets the name of the SQL function to be invoke in this expression.
Parameters
- 
                string$name
- The name of the function 
Returns
$thissetReturnType() ¶ public
setReturnType(string $type): $thisSets the type of the value this object will generate.
Parameters
- 
                string$type
- The name of the type that is to be returned 
Returns
$thissetTypeMap() ¶ public
setTypeMap(array|Cake\Database\TypeMap $typeMap): $thisCreates a new TypeMap if $typeMap is an array, otherwise exchanges it for the given one.
Parameters
- 
                array|Cake\Database\TypeMap$typeMap
- Creates a TypeMap if array, otherwise sets the given TypeMap 
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
$_conditions ¶ protected
A list of strings or other expression objects that represent the "branches" of the expression tree. For example one key of the array might look like "sum > :value"
Type
array$_conjunction ¶ protected
String to be used for joining each of the internal expressions this object internally stores for example "AND", "OR", etc.
Type
string$_name ¶ protected
The name of the function to be constructed when generating the SQL string
Type
string