public function expr(Model $m, $expr, $args = [])
    {
        if (!is_string($expr)) {
            return $this->connection->expr($expr, $args);
        }
        preg_replace_callback(
            '/\[[a-z0-9_]*\]|{[a-z0-9_]*}/i',
            function ($matches) use (&$args, $m) {
                $identifier = substr($matches[0], 1, -1);
                if ($identifier && !isset($args[$identifier])) {
                    $args[$identifier] = $m->getField($identifier);
                }

                return $matches[0];
            },
            $expr
        );

        return $this->connection->expr($expr, $args);
    }
public function expr(Model $m, $expr, $args = [])
    {
        if (!is_string($expr)) {
            return $this->connection->expr($expr, $args);
        }
        preg_replace_callback(
            '/\[[a-z0-9_]*\]|{[a-z0-9_]*}/i',
            function ($matches) use (&$args, $m) {
                $identifier = substr($matches[0], 1, -1);
                if ($identifier && !isset($args[$identifier])) {
                    $args[$identifier] = $m->getField($identifier);
                }

                return $matches[0];
            },
            $expr
        );

        return $this->connection->expr($expr, $args);
    }
public function expr ( Model $ m , $ expr , $ args = [ ] ) { if ( ! is_string ( $ expr ) ) { return $ this -> connection -> expr ( $ expr , $ args ) ; } preg_replace_callback ( '/\[[a-z0-9_]*\]|{[a-z0-9_]*}/i' , function ( $ matches ) use ( & $ args , $ m ) { $ identifier = substr ( $ matches [ 0 ] , 1 , - 1 ) ; if ( $ identifier && ! isset ( $ args [ $ identifier ] ) ) { $ args [ $ identifier ] = $ m -> getField ( $ identifier ) ; } return $ matches [ 0 ] ; } , $ expr ) ; return $ this -> connection -> expr ( $ expr , $ args ) ; }
Creates new Expression object from expression string.

@param Model $m
@param mixed $expr
@param array $args

@return \atk4\dsql\Expression
Creates new Expression object from expression string .