W3cubDocs

/CakePHP 3.8

Class UnaryExpression

An expression object that represents an expression with only a single operand.

Cake\Database\Expression\UnaryExpression implements Cake\Database\ExpressionInterface

Constants summary

  • integer

    POSTFIX
    1
  • integer

    PREFIX
    0

Properties summary

  • $_mode protected
    integer
    Where to place the operator
  • $_operator protected
    string
    The operator this unary expression represents
  • $_value protected
    mixed
    Holds the value which the unary expression operates

Method Summary

  • __clone() public
    Perform a deep clone of the inner expression.
  • __construct() public
    Constructor
  • sql() public
    Converts the expression to its string representation
  • traverse() public

    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.

Method Detail

__clone()source public

__clone( )

Perform a deep clone of the inner expression.

__construct()source public

__construct( string $operator , mixed $value , integer $mode = self::PREFIX )

Constructor

Parameters

string $operator
The operator to used for the expression
mixed $value
the value to use as the operand for the expression
integer $mode optional self::PREFIX
either UnaryExpression::PREFIX or UnaryExpression::POSTFIX

sql()source public

sql( Cake\Database\ValueBinder $generator )

Converts the expression to its string representation

Parameters

Cake\Database\ValueBinder $generator
Placeholder generator object

Returns

string

Implementation of

Cake\Database\ExpressionInterface::sql()

traverse()source public

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.

Parameters

callable $callable
$visitor The callable to apply to all nodes.

Implementation of

Cake\Database\ExpressionInterface::traverse()

Properties detail

$_modesource

protected integer

Where to place the operator

$_operatorsource

protected string

The operator this unary expression represents

$_valuesource

protected mixed

Holds the value which the unary expression operates

© 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/3.8/class-Cake.Database.Expression.UnaryExpression.html