Cake\Database\Query::_conjugate PHP Method

_conjugate() protected method

Helper function used to build conditions by composing QueryExpression objects.
protected _conjugate ( string $part, string | null | array | Cake\Database\ExpressionInterface | callable $append, string $conjunction, array $types ) : void
$part string Name of the query part to append the new part to
$append string | null | array | Cake\Database\ExpressionInterface | callable Expression or builder function to append.
$conjunction string type of conjunction to be used to operate part
$types array associative array of type names used to bind values to query
return void
    protected function _conjugate($part, $append, $conjunction, $types)
    {
        $expression = $this->_parts[$part] ?: $this->newExpr();
        if (empty($append)) {
            $this->_parts[$part] = $expression;
            return;
        }
        if ($expression->isCallable($append)) {
            $append = $append($this->newExpr(), $this);
        }
        if ($expression->tieWith() === $conjunction) {
            $expression->add($append, $types);
        } else {
            $expression = $this->newExpr()->tieWith($conjunction)->add([$append, $expression], $types);
        }
        $this->_parts[$part] = $expression;
        $this->_dirty();
    }