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
Cake\Database\Expression\FunctionExpression
_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' Cake\Database\Expression\FunctionExpression
_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' Cake\Database\Expression\FunctionExpression
avg( mixed $expression , array $types [] )
Returns a FunctionExpression representing a call to SQL AVG function.
$expression
$types
optional [] Cake\Database\Expression\FunctionExpression
coalesce( array $args , array $types [] )
Returns a FunctionExpression representing a call to SQL COALESCE function.
$args
$types
optional [] Cake\Database\Expression\FunctionExpression
concat( array $args , array $types [] )
Returns a FunctionExpression representing a string concatenation
$args
$types
optional [] Cake\Database\Expression\FunctionExpression
count( mixed $expression , array $types [] )
Returns a FunctionExpression representing a call to SQL COUNT function.
$expression
$types
optional [] Cake\Database\Expression\FunctionExpression
dateAdd( string $expression , string $value , string $unit , array $types [] )
Add the time unit to the date expression
$expression
$value
$unit
$types
optional [] Cake\Database\Expression\FunctionExpression
dateDiff( array $args , array $types [] )
Returns a FunctionExpression representing the difference in days between two dates.
$args
$types
optional [] Cake\Database\Expression\FunctionExpression
datePart( string $part , string $expression , array $types [] )
Returns the specified date part from the SQL expression.
$part
$expression
$types
optional [] Cake\Database\Expression\FunctionExpression
dayOfWeek( mixed $expression , array $types [] )
Returns a FunctionExpression representing a call to SQL WEEKDAY function. 1 - Sunday, 2 - Monday, 3 - Tuesday...
$expression
$types
optional [] Cake\Database\Expression\FunctionExpression
extract( string $part , string $expression , array $types [] )
Returns the specified date part from the SQL expression.
$part
$expression
$types
optional [] Cake\Database\Expression\FunctionExpression
max( mixed $expression , array $types [] )
Returns a FunctionExpression representing a call to SQL MAX function.
$expression
$types
optional [] Cake\Database\Expression\FunctionExpression
min( mixed $expression , array $types [] )
Returns a FunctionExpression representing a call to SQL MIN function.
$expression
$types
optional [] Cake\Database\Expression\FunctionExpression
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' Cake\Database\Expression\FunctionExpression
sum( mixed $expression , array $types [] )
Returns a FunctionExpression representing a call to SQL SUM function.
$expression
$types
optional [] Cake\Database\Expression\FunctionExpression
weekday( mixed $expression , array $types [] )
Returns a FunctionExpression representing a call to SQL WEEKDAY function. 1 - Sunday, 2 - Monday, 3 - Tuesday...
$expression
$types
optional [] Cake\Database\Expression\FunctionExpression
© 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.5/class-Cake.Database.FunctionsBuilder.html