Trait ExpressionTypeCasterTrait

Offers a method to convert values to ExpressionInterface objects if the type they should be converted to implements ExpressionTypeInterface

Namespace: Cake\Database\Type

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.

  • _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 $type)

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 converto to ExpressionInterface

string|null $type optional

The type name

Returns

mixed

_requiresToExpressionCasting() protected

_requiresToExpressionCasting(array $types)

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

© 2005–present 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/4.1/trait-Cake.Database.Type.ExpressionTypeCasterTrait.html