A Comparison is a type of query expression that represents an operation involving a field an operator and a value. In its most common form the string representation of a comparison is field = value
$_isMultiple
protected boolean
$_operator
protected string
$_type
protected string|array
$_value
protected mixed
$_valueExpressions
protected A cached list of ExpressionInterface objects that were found in the value for this expression.
Returns an array with the original $values in the first position and all ExpressionInterface objects that could be found in the second position.
Converts a traversable value into a set of placeholders generated by $generator and separated by ,
Returns a template and a placeholder for the value after registering it with the placeholder $generator
Iterates over each part of the expression recursively for every level of the expressions tree and executes the $visitor callable passing as first parameter the instance of the expression currently being iterated.
__clone( )
Create a deep clone.
Clones the field and value if they are expression objects.
__construct( string|Cake\Database\ExpressionInterface $field , mixed $value , string $type , string $operator )
Constructor
Cake\Database\ExpressionInterface
$field
$value
$type
$operator
_bindValue( mixed $value , Cake\Database\ValueBinder $generator , string $type )
Registers a value in the placeholder generator and returns the generated placeholder
$value
$generator
$type
_collectExpressions( array|Traversable $values )
Returns an array with the original $values in the first position and all ExpressionInterface objects that could be found in the second position.
$values
_flattenValue( array|Traversable $value , Cake\Database\ValueBinder $generator , string|array|null $type 'string' )
Converts a traversable value into a set of placeholders generated by $generator and separated by ,
$value
$generator
$type
optional 'string' _stringExpression( Cake\Database\ValueBinder $generator )
Returns a template and a placeholder for the value after registering it with the placeholder $generator
$generator
setOperator( string $operator )
Sets the operator to use for the comparison
$operator
setValue( mixed $value )
Sets the value
$value
sql( Cake\Database\ValueBinder $generator )
Convert the expression into a SQL fragment.
$generator
Cake\Database\ExpressionInterface::sql()
traverse( callable $callable )
Iterates over each part of the expression recursively for every level of the expressions tree and executes the $visitor callable passing as first parameter the instance of the expression currently being iterated.
$callable
Cake\Database\ExpressionInterface::traverse()
_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.
$value
$type
_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.
$types
getField( )
Returns the field name
Cake\Database\ExpressionInterface
setField( string|Cake\Database\ExpressionInterface $field )
Sets the field name
Cake\Database\ExpressionInterface
$field
protected boolean
Whether or not the value in this expression is a traversable
false
protected string|array
The type to be used for casting the value to a database representation
protected Cake\Database\ExpressionInterface[]
A cached list of ExpressionInterface objects that were found in the value for this expression.
[]
© 2005–2018 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.Expression.Comparison.html