pounard / goat-query

Goat SQL query builder built over a PHP to SQL and SQL to PHP type converter
GNU General Public License v2.0
2 stars 0 forks source link

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

Closed Lonnytunes closed 4 years ago

Lonnytunes commented 4 years ago

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.

pounard commented 4 years ago

Cimère Robert !