Trait CaseExpressionTrait
Trait that holds shared functionality for case related expressions.
Method Summary
-
castToExpression() protected
Conditionally converts the passed value to an ExpressionInterface object if the type class implements the ExpressionTypeInterface. Otherwise, returns the value unmodified.
-
compileNullableValue() protected
Compiles a nullable value to SQL.
-
inferType() protected
Infers the abstract type for the given value.
-
requiresToExpressionCasting() protected
Returns an array with the types that require values to be casted to expressions, out of the list of type names passed as parameter.
Method Detail
castToExpression() ¶ protected
castToExpression(mixed $value, string|null $type = null): mixed
Conditionally 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
mixedcompileNullableValue() ¶ protected
compileNullableValue(Cake\Database\ValueBinder $binder, Cake\Database\ExpressionInterface|object|scalar|null $value, string|null $type = null): string
Compiles a nullable value to SQL.
Parameters
-
Cake\Database\ValueBinder$binder The value binder to use.
-
Cake\Database\ExpressionInterface|object|scalar|null$value The value to compile.
-
string|null$type optional The value type.
Returns
stringinferType() ¶ protected
inferType(mixed $value, Cake\Database\TypeMap|null $typeMap = null): string|null
Infers the abstract type for the given value.
Parameters
-
mixed$value The value for which to infer the type.
-
Cake\Database\TypeMap|null$typeMap optional Used to resolve the type of identifier expressions.
Returns
string|nullThe abstract type, or null if it could not be inferred.
requiresToExpressionCasting() ¶ protected
requiresToExpressionCasting(array $types): array
Returns 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
array