pounard / goat-query

Goat SQL query builder built over a PHP to SQL and SQL to PHP type converter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't provide a new Where object to the Where::condition() method

Lonnytunes opened this issue · comments

I built a query looking like this:

$count = $this
    ->getRunner()
    ->getQueryBuilder()
    ->select('...')
    // ...
    ->condition((new Where(Where::OR)) // <- Not accepted.
        ->isNull('...')
        ->isNull('...')
        ->isNull('...')
    )
    ->getCountQuery()
    ->execute()
    ->fetchField()
;

Giving a new Where object to the condition method results in a QueryError:

Goat\Query\QueryError: column reference must be a string or an instance of Goat\Query\ExpressionColumn

The problem comes from ExpressionFactory::column() called at line 119 of Where::condition(). It only accepts string or Expression as argument.

Cimère Robert !