|
|
@@ -50,7 +50,7 @@ class FunctionsBuilder
|
|
|
* argument.
|
|
|
*
|
|
|
* @param string $name name of the function to build
|
|
|
- * @param mixed $expression the function argument
|
|
|
+ * @param string|\Cake\Database\ExpressionInterface $expression the function argument
|
|
|
* @param array $types list of types to bind to the arguments
|
|
|
* @param string $return The return type for the function
|
|
|
* @return \Cake\Database\Expression\FunctionExpression
|
|
|
@@ -83,7 +83,7 @@ class FunctionsBuilder
|
|
|
/**
|
|
|
* Returns a FunctionExpression representing a call to SQL SUM function.
|
|
|
*
|
|
|
- * @param mixed $expression the function argument
|
|
|
+ * @param string|\Cake\Database\ExpressionInterface $expression the function argument
|
|
|
* @param array $types list of types to bind to the arguments
|
|
|
* @return \Cake\Database\Expression\FunctionExpression
|
|
|
*/
|
|
|
@@ -100,7 +100,7 @@ class FunctionsBuilder
|
|
|
/**
|
|
|
* Returns a FunctionExpression representing a call to SQL AVG function.
|
|
|
*
|
|
|
- * @param mixed $expression the function argument
|
|
|
+ * @param string|\Cake\Database\ExpressionInterface $expression the function argument
|
|
|
* @param array $types list of types to bind to the arguments
|
|
|
* @return \Cake\Database\Expression\FunctionExpression
|
|
|
*/
|
|
|
@@ -112,7 +112,7 @@ class FunctionsBuilder
|
|
|
/**
|
|
|
* Returns a FunctionExpression representing a call to SQL MAX function.
|
|
|
*
|
|
|
- * @param mixed $expression the function argument
|
|
|
+ * @param string|\Cake\Database\ExpressionInterface $expression the function argument
|
|
|
* @param array $types list of types to bind to the arguments
|
|
|
* @return \Cake\Database\Expression\FunctionExpression
|
|
|
*/
|
|
|
@@ -124,7 +124,7 @@ class FunctionsBuilder
|
|
|
/**
|
|
|
* Returns a FunctionExpression representing a call to SQL MIN function.
|
|
|
*
|
|
|
- * @param mixed $expression the function argument
|
|
|
+ * @param string|\Cake\Database\ExpressionInterface $expression the function argument
|
|
|
* @param array $types list of types to bind to the arguments
|
|
|
* @return \Cake\Database\Expression\FunctionExpression
|
|
|
*/
|
|
|
@@ -136,7 +136,7 @@ class FunctionsBuilder
|
|
|
/**
|
|
|
* Returns a FunctionExpression representing a call to SQL COUNT function.
|
|
|
*
|
|
|
- * @param mixed $expression the function argument
|
|
|
+ * @param string|\Cake\Database\ExpressionInterface $expression the function argument
|
|
|
* @param array $types list of types to bind to the arguments
|
|
|
* @return \Cake\Database\Expression\FunctionExpression
|
|
|
*/
|
|
|
@@ -186,11 +186,11 @@ class FunctionsBuilder
|
|
|
* Returns the specified date part from the SQL expression.
|
|
|
*
|
|
|
* @param string $part Part of the date to return.
|
|
|
- * @param string $expression Expression to obtain the date part from.
|
|
|
+ * @param string|\Cake\Database\ExpressionInterface $expression Expression to obtain the date part from.
|
|
|
* @param array $types list of types to bind to the arguments
|
|
|
* @return \Cake\Database\Expression\FunctionExpression
|
|
|
*/
|
|
|
- public function datePart(string $part, string $expression, array $types = []): FunctionExpression
|
|
|
+ public function datePart(string $part, $expression, array $types = []): FunctionExpression
|
|
|
{
|
|
|
return $this->extract($part, $expression, $types);
|
|
|
}
|
|
|
@@ -199,11 +199,11 @@ class FunctionsBuilder
|
|
|
* Returns the specified date part from the SQL expression.
|
|
|
*
|
|
|
* @param string $part Part of the date to return.
|
|
|
- * @param string $expression Expression to obtain the date part from.
|
|
|
+ * @param string|\Cake\Database\ExpressionInterface $expression Expression to obtain the date part from.
|
|
|
* @param array $types list of types to bind to the arguments
|
|
|
* @return \Cake\Database\Expression\FunctionExpression
|
|
|
*/
|
|
|
- public function extract(string $part, string $expression, array $types = []): FunctionExpression
|
|
|
+ public function extract(string $part, $expression, array $types = []): FunctionExpression
|
|
|
{
|
|
|
$expression = $this->_literalArgumentFunction('EXTRACT', $expression, $types, 'integer');
|
|
|
$expression->setConjunction(' FROM')->add([$part => 'literal'], [], true);
|
|
|
@@ -214,13 +214,13 @@ class FunctionsBuilder
|
|
|
/**
|
|
|
* Add the time unit to the date expression
|
|
|
*
|
|
|
- * @param string $expression Expression to obtain the date part from.
|
|
|
+ * @param string|\Cake\Database\ExpressionInterface $expression Expression to obtain the date part from.
|
|
|
* @param string|int $value Value to be added. Use negative to subtract.
|
|
|
* @param string $unit Unit of the value e.g. hour or day.
|
|
|
* @param array $types list of types to bind to the arguments
|
|
|
* @return \Cake\Database\Expression\FunctionExpression
|
|
|
*/
|
|
|
- public function dateAdd(string $expression, $value, string $unit, array $types = []): FunctionExpression
|
|
|
+ public function dateAdd($expression, $value, string $unit, array $types = []): FunctionExpression
|
|
|
{
|
|
|
if (!is_numeric($value)) {
|
|
|
$value = 0;
|
|
|
@@ -236,7 +236,7 @@ class FunctionsBuilder
|
|
|
* Returns a FunctionExpression representing a call to SQL WEEKDAY function.
|
|
|
* 1 - Sunday, 2 - Monday, 3 - Tuesday...
|
|
|
*
|
|
|
- * @param mixed $expression the function argument
|
|
|
+ * @param string|\Cake\Database\ExpressionInterface $expression the function argument
|
|
|
* @param array $types list of types to bind to the arguments
|
|
|
* @return \Cake\Database\Expression\FunctionExpression
|
|
|
*/
|
|
|
@@ -249,7 +249,7 @@ class FunctionsBuilder
|
|
|
* Returns a FunctionExpression representing a call to SQL WEEKDAY function.
|
|
|
* 1 - Sunday, 2 - Monday, 3 - Tuesday...
|
|
|
*
|
|
|
- * @param mixed $expression the function argument
|
|
|
+ * @param string|\Cake\Database\ExpressionInterface $expression the function argument
|
|
|
* @param array $types list of types to bind to the arguments
|
|
|
* @return \Cake\Database\Expression\FunctionExpression
|
|
|
*/
|