Contains methods related to generating FunctionExpression objects with most commonly used SQL functions. This acts as a factory for FunctionExpression objects.
Returns a new instance of a FunctionExpression. This is used for generating arbitrary function calls in the final SQL string.
Helper function to build a function expression that only takes one literal argument.
Returns a FunctionExpression representing the difference in days between two dates.
Returns a FunctionExpression representing a call to SQL WEEKDAY function. 1 - Sunday, 2 - Monday, 3 - Tuesday...
Returns a FunctionExpression representing a call that will return the current date and time. By default it returns both date and time, but you can also make it generate only the date or only the time.
Returns a FunctionExpression representing a call to SQL WEEKDAY function. 1 - Sunday, 2 - Monday, 3 - Tuesday...
__call( string $name , array $args )
Magic method dispatcher to create custom SQL function calls
$name
$args
list with up to 3 arguments, first one being an array with parameters for the SQL function, the second one a list of types to bind to those params, and the third one the return type of the function
_build( string $name , array $params [] , array $types [] , string $return 'string' )
Returns a new instance of a FunctionExpression. This is used for generating arbitrary function calls in the final SQL string.
$name
$params
optional [] $types
optional [] $return
optional 'string' _literalArgumentFunction( string $name , mixed $expression , array $types [] , string $return 'string' )
Helper function to build a function expression that only takes one literal argument.
$name
$expression
$types
optional [] $return
optional 'string' avg( mixed $expression , array $types [] )
Returns a FunctionExpression representing a call to SQL AVG function.
$expression
$types
optional [] coalesce( array $args , array $types [] )
Returns a FunctionExpression representing a call to SQL COALESCE function.
$args
$types
optional [] concat( array $args , array $types [] )
Returns a FunctionExpression representing a string concatenation
$args
$types
optional [] count( mixed $expression , array $types [] )
Returns a FunctionExpression representing a call to SQL COUNT function.
$expression
$types
optional [] dateAdd( string $expression , string $value , string $unit , array $types [] )
Add the time unit to the date expression
$expression
$value
$unit
$types
optional [] dateDiff( array $args , array $types [] )
Returns a FunctionExpression representing the difference in days between two dates.
$args
$types
optional [] datePart( string $part , string $expression , array $types [] )
Returns the specified date part from the SQL expression.
$part
$expression
$types
optional [] dayOfWeek( mixed $expression , array $types [] )
Returns a FunctionExpression representing a call to SQL WEEKDAY function. 1 - Sunday, 2 - Monday, 3 - Tuesday...
$expression
$types
optional [] extract( string $part , string $expression , array $types [] )
Returns the specified date part from the SQL expression.
$part
$expression
$types
optional [] max( mixed $expression , array $types [] )
Returns a FunctionExpression representing a call to SQL MAX function.
$expression
$types
optional [] min( mixed $expression , array $types [] )
Returns a FunctionExpression representing a call to SQL MIN function.
$expression
$types
optional [] now( string $type 'datetime' )
Returns a FunctionExpression representing a call that will return the current date and time. By default it returns both date and time, but you can also make it generate only the date or only the time.
$type
optional 'datetime' sum( mixed $expression , array $types [] )
Returns a FunctionExpression representing a call to SQL SUM function.
$expression
$types
optional [] weekday( mixed $expression , array $types [] )
Returns a FunctionExpression representing a call to SQL WEEKDAY function. 1 - Sunday, 2 - Monday, 3 - Tuesday...
$expression
$types
optional []
© 2005–2017 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/3.4/class-Cake.Database.FunctionsBuilder.html