Repository navigation
v1.0.0-RC5
Pre-release
Pre-release
Fifth release candidate of Solo Repository (solophp/repository). It adds locking reads, ordering by the fields of related rows and native upserts — what the first application with 140 tables still wrote by hand.
This is a prerelease: the 1.0 API is being validated in real applications before the stable 1.0.0 tag.
Migrating from Base Repository v3: read the migration guide.
Changes since 1.0.0-RC4
ReadQuery::forUpdate()returns the same read as a locking one:find(),findOneBy(),findBy(),rows(),exists()anditerateById()runSELECT ... FOR UPDATEand lock the rows they read until the transaction ends, and throwLogicExceptionoutside a transaction. A locking read never answers from the snapshot of a REPEATABLE READ transaction: MySQL reads the latest committed row, while PostgreSQL and MariaDB reject a row changed since the snapshot as a serialization failure. PostgreSQL and MySQL 8 lock only the rows of the read's table (FOR UPDATE OF). See the read API.orderByaccepts dotted paths throughBelongsTorelations to a field of the target, such ascategory.name, in reads, default relation orders andLoadorders. Each target is joined over the rows a load of the same relation in the read sees, so a list that shows soft-deleted rows throughVisibility::Allalso orders by them.Repository::upsert($key, $data, $onInsert = [])inserts the row of a unique key, or updates the row that already holds it, in one native statement. See Repository writes.- Behavior change:
insertMany()runs a batch that fits one statement without a transaction or savepoint. Inside a caller's transaction on PostgreSQL, a failure of such a batch now aborts that transaction, as a failedinsert()does. Loadand default relation orders accept the same paths, resolved when the read prepares its loads; an invalid order key reports "Order must use field names or relation paths to fields."
Install
composer require 'solophp/repository:^1.0@RC'See the changelog for the full list of features and requirements, and the full diff since RC4.