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

Allow callables instead of all expressions

pounard opened this issue · comments

Normalize expression processing, allow them to be callables, everywhere, examples:

$select->with('top_sales', function (SelectQuery $select) {
    // $select is a new SELECT query to be used for the WITH statement
    // ... write your own $select query
});

Or:

$select->condition(function (Where $where) {
    // ... do something with $where
});

Or:

$select->getWhere()->exists(function (SelectQuery $query) {
    // $select is a new SELECT query to be used for the WITH statement
    // ... write your own $select query
});

Or more generally, all expressions to be:

$select->expression(function (...$contextualParameters) {
    // ... return some string or Expression instance
});

Query builder has been subjected to a major overhaul, it's now much more flexible and accepts arbitrary expressions and callables pretty much everywhere it's possible. This is fixed.