Releases: justim/access
v1.22.1
v1.22.0
What's Changed
- Add support for
UNIONqueries (c660fff) - Add new collection method:
deduplicate(fa1b331) - Flag to include soft deleted records in queries (2291a1b, 31d0452 and 7fbebeb)
- New cursor type (69de255 and fc3004f)
- Rework of
ORDER BYin queries (be4e7eb)
Pull requests
- Drivers by @justim in #11
- Tiny contribution to fix provideCollection method template by @yrodchyn in #12
- Split lint and test GitHub actions + PHP 8.4 by @justim in #13
- Psalm 6 + presenter improvements by @justim in #14
Full Changelog: v1.21.0...v1.22.0
Nested transactions + filter clauses
Nested transactions
- Inner transactions will use savepoints to roll back to
Filter clauses
- Filter the presentation markers in a declarative way
Full Changelog: v1.16.1...v1.17.0
Improved generic typings + clauses for multiple
Improved generic typings
- This gives a better usage of the helper methods of collection
- The presenter now better understands what entity it is dealing with
- Start linting tests to give better insight
Rework how multiple entities are handled in presenters
- Removal of workaround for broken JSON responses
- Clauses to
presentMultiple
Full Changelog: v1.15.3...v1.16.0
Rework query conditions + PHP 8.0
Rework query conditions
A rework of the query condition internals allows for a new external API as well:
$query = new Query\Select(User::class);
$query->where(Equals('id', 4));These are the same conditions that are already in use in the presenters, for additional query clauses when selecting data.
The main reason this is helpful for queries is that it is now possible to use multiple conditions with multiple placeholders. The following indicates a query that was not previously possible:
$query = new Query\Select(User::class);
$query->whereOr([
'first_name = ? AND last_name = ?' => 'Dave', // second placeholder is not possible
'is_admin = ?' => true,
]);With the new conditions API it is now possible:
$query = new Query\Select(User::class);
$query->where(new MultipleOr(
new Multiple(
new Equals('first_name = ?', 'Dave'),
new Equals('last_name = ?', 'Johnny'), // second placeholder is now possible
),
new Equals('is_admin = ?', true),
));The new API is very much optional and the string like interface still works as expected and is converted to the conditions automatically internally.
Updated PHP dependency
From this release forward the minimal required PHP version is 8.0.
Allow entities to be passed as a value
This makes it a bit easier to build queries and select entities
This is now allowed:
// finder methods
$repo->findBy([
// an entity `Entity`
'id' => $user,
// a collection `Collection`
'id' => $users,
]);
// query builder
$query->innerJoin(SomeEntity::class, [
'other_table.user_id = ?' => $user,
]);Convert entities with presenters
New features
- Presenters: Easily present your entities as JSON without worrying about n+1 queries
- Filter method on collections
Changes
- Use prettier to format all code
Grouped collections
Use GroupedCollection instead of plain array, this makes type-hinting a lot easier and maybe some nice feature in the future
Subqueries, locks and more
New features:
- Subqueries in virtual fields
- Simple lock mechanism
- Add hydration times to profile
- A couple more helper methods for collections
Changes:
- Add support for where statements with same condition
Transactions and more
New in this release:
-
Transactions:
$transaction = $db->beginTransaction(); // your fancy insert/update queries $transaction->commit(); // or $transaction->rollBack(); // make sure to either commit or roll back, otherwise an exception is thrown
-
More type information with Psalm
-
Small setup with a single benchmark
-
A new
savemethod if you don't want to think about choosing betweeninsertandupdate