Releases: Finesse/MiniDB
Releases · Finesse/MiniDB
0.7.4
Fixed:
-
Getting an aggregate fails when the query has derived fields (defined in the select section) in the order section. Example, reproducing the error:
$database ->table('posts') ->addSelect($database->raw('likes_count + comments_count'), 'acknowledgement') ->orderBy('acknowledgement', 'desc') ->count();
A more live example:
$query = $database ->table('posts') ->addSelect($database->raw('likes_count + comments_count'), 'acknowledgement') ->orderBy('acknowledgement', 'desc'); $paginator = new Pagerfanta(new PagerfantaAdapter($query)); $pagesCount = $paginator->getNbPages();
0.7.3
0.7.2
0.7.1
Fixed:
-
The
where
method of aQuery
object with a custom closure resolver fails when it receives an array of criteria. Example:$query = new QueryProxy($database->table('posts')); $query->where([ ['column1', 'value1'], ['column2', 'value2'] ]);
If you extend the
Query
class and override themakeEmptyCopy
method, changepublic makeEmptyCopy
toprotected constructEmptyCopy
in order to fix this bug.
0.7.0
- Added the «nulls first» and the «nulls last» sorts (the
Query::orderByNullFist
andQuery::orderBuNullLast
methods respectively) - Added the explicit order sort (the
Query::inExplicitOrder
method)
Breaking changes:
- The
applyCallback
method of theQuery
andQueryProxy
classes is renamed toapply
- The
Query::where
and theQuery::whereColumn
method behaviour depends on the number of arguments but not the arguments values. So if you write$query->where('name', '>', $name)
the SQL will always beWHERE "name" > ?
even if$name
is null. Also these methods have stopped accepting the "append rule" argument.
0.6.0
Breaking changes:
Finesse\MiniDB\Exceptions\InvalidReturnValueException
extendsLogicException
, notRuntimeException
.
Fixed:
- PhpStorm thinks that the
Finesse\MiniDB\Query::applyCallback
method returns an instance of theFinesse\QueryScribe\Query
class (and the same with theQueryProxy
class).
0.5.0
- Added the
Database::builder
method which creates empty query instances. It helps to replace the used query class while extending theDatabase
class. - Calling
$query->where('field', null)
doesn't throw an error (but it is still not the same as$query->whereNull('field')
). - The
Query
andQueryProxy
classes got theapplyCallback
method to make application a callback to a query be easy. - All the
QueryProxy
exceptions are handled in theQueryProxy::handleException
method.
Fixed:
QueryProxy
throws Query ScribeInvalidReturnValueException
instead of MiniDBInvalidReturnValueException
.
Backward incompatible:
- If a
Query
argument closure returns a wrong value,InvalidReturnValueException
is thrown instead ofInvalidArgumentException
. - The
Query
andQueryProxy
resolveClosure
methods are removed prior to theapplyCallback
methods. - The
QueryProxy::handleBaseQueryException
method is renamed tohandleException
.
0.4.0
- The
Database
andQuery
classes got the methodescapeLikeWildcards
to escape LIKE special characters. - The
Database
andQuery
classes got the methodsquoteIdentifier
andquoteCompositeIdentifier
to quote identifiers in raw queries. - The
addTablePrefix
andaddTablePrefixToColumn
methods are available in theQuery
too.
Backward incompatible:
- The
Query::where...
methods accept string SQL logical operator names ('AND'
,'OR'
) instead of theCriterion::APPEND_RULE_...
constants. TheCriterion::APPEND_RULE_...
constants are removed. - All the traits moved to the
Finesse\MiniDB\Parts
namespace.