W3cubDocs

/CakePHP 3.4

Trait ExpressionTypeCasterTrait

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

Method Summary

  • Conditionally converts the passed value to an ExpressionInterface object if the type class implements the ExpressionTypeInterface. Otherwise, returns the value unmodified.

  • 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()source 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 $type
The type name

Returns

mixed

_requiresToExpressionCasting()source 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–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.Type.ExpressionTypeCasterTrait.html