Doctrine\OrientDB\Query\Command::where PHP Method

where() public method

Adds a WHERE conditions into the current query.
public where ( string $condition, mixed $value = null, boolean $append = false, string $clause = "WHERE" )
$condition string
$value mixed
$append boolean
$clause string
    public function where($condition, $value = null, $append = false, $clause = "WHERE")
    {
        if (is_array($value)) {
            $condition = $this->formatWhereConditionWithMultipleTokens($condition, $value, $this->escapeValidator);
        } else {
            if ($value === null) {
                $condition = preg_replace("/=\\s*\\?/", "IS ?", $condition, 1);
                $value = 'NULL';
            } else {
                if (is_bool($value)) {
                    $value = $value ? 'TRUE' : 'FALSE';
                } else {
                    if (is_int($value) || is_float($value)) {
                        // Preserve $value as is
                    } else {
                        $rid = $this->ridValidator->check($value, true);
                        $value = $rid ? $rid : '"' . $this->escapeValidator->check($value, true) . '"';
                    }
                }
            }
            $condition = str_replace("?", $value, $condition);
        }
        if (!$this->getTokenValue('Where')) {
            $clause = 'WHERE';
        }
        $this->setTokenValues('Where', array("{$clause} {$condition}"), $append, false, false);
        return $this;
    }