Changes
- Small static analysis fix.
It's time! Finally a 1.0.0 release, locking the interface in place for at least a while.
Changes
- Namespace
Translator
has been renamed toTranslators
for consistency. - Namespace
Condition
has been renamed toConditions
for consistency.
- Added static analysis through psalm.
- Renamed
Exception
toQueryException
for clarity. - General php8 code style upgrades.
Changes
- Dropped support for php7, php8 only from now on.
- Removed unnecessary check whether an update query had an alias.
- Fixed bug where values that implemented
__toString()
were not correctly identified as such, and would remain unquoted. - Fixed test assert value to be more specific.
Bugfixes
buildInsertValues()
used the wrong glue to implode value sets.
Changes
- The
SupportsForceIndexTrait
traitQuery::forceIndex(string $key)
andQuery::getForceIndex(): ?string
have been added, allowing you to force a specific index. UsePRIMARY_KEY_INDEX_VALUE
in place of the actual primary key to force the primary key as an index. Query::delete()
andQuery::update()
no longer accept aliases since they caused issues.AbstractCondition::VALUE_TYPE_VALUE
andAbstractCondition::VALUE_TYPE_KEY
have been removed.Query::ORDER_ASC
andQuery::ORDER_DESC
have been removed.Query::VALID_TYPES
has been removed, as it was unused.- All string values of
AND
andOR
have been replaced withAbstractCondition::TYPE_AND
andAbstractCondition::TYPE_OR
. ORDER_ASC
andORDER_DESC
have been changed fromint
values to their correspondingstring
valuesASC
andDESC
.OrderBy::getDirectionAsString()
has turned intoOrderBy::getDirection()
.- The
BuilderTest
now also attempts to run the queries. Adding this step made some issues clear, which are now all fixed.
Changes
hasValueSets()
was removed but proves useful enough to put back in.Order
renamed toOrderBy
, can no longer be created without keys being passed.
Changes
-
Query::orderBy()
now takes anOrder
object, rather than string values. Example:->orderBy(Order::asc('id', 'username'))
, which will parse toORDER BY id ASC, username ASC
. Use::desc
for descending. You can call it multiple times, so you can do one keyASC
, one keyDESC
, and then anotherASC
if you want.NOTE: Adding a key more than once is possible, but not if they are of different directions.
-
Most places where single-type values were being passed into a method as an array, it now expects the values to be passed as multiple parameters. These methods expect multiple parameters rather than an array:
Order::asc(...$keys)
Order::desc(...$keys)
Query::setColumns(...$columns)
Query::groupBy(...$keys)
-
Translators are now type-hinted as
TranslatorInterface
and all methods onAbstractTranslator
have been made protected. This makes it easier to see what functionality is necessary to expose to the outside. -
Query
has gained some quality of life methods:hasWhereConditions(): bool
,hasGroupBy(): bool
,hasOrderBy(): bool
andcountValueSets(): int
. -
Query::createCleanClone()
has been added, which will return a copy of the query you called it on, with no further configuration whatsoever being retained.
Bugfixes
- Make sure we never try to
quote()
a non-string value by string-casting before we hand it over toPDO
.
Changes
- Code style fixes.
- Fixed typo in exception.
Changes
- Added
hasValueSets()
toQuery
- Added
hasValues()
toValueSet
SupportsValuesTrait
now treatsnull
values to mean the value should beNULL
-ed. Leaving out the value in theValueSet
values will simply not add it to the values list.
Changes
- Added
whereCondition
toQuery
andonCondition
toJoin
.
Bugfixes
- Renamed
whereCallable
inJoin
toonCallable
, as it should've been named in the first place.
Changes
- First release.