Repository navigation
v1.0.0-RC2
Pre-release
Pre-release
Second release candidate of Solo Repository (solophp/repository). It closes the gaps that migrating the first real application from RC1 revealed, and lowers the time and memory of reads, relation loads and insertMany().
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 RC1
ReadQuery::queryBuilder($alias, $criteria)returns a DBALQueryBuilderwith the mapped table under the alias in FROM, the criteria and visibility in WHERE, and the translation joins the criteria need. It selects nothing: add the SELECT, joins and grouping, and add your own conditions withandWhere(), becausewhere()replaces the criteria and visibility. It replaces v3'stable()withapplyCriteria().- Mappings without a primary key:
Mapping::$primaryKeymay be NULL for tables with composite keys. Their rows are read, inserted and changed by criteria, and operations by ID throw before SQL. Translations::$defaultLocaleis optional. Without it, a read that names no locale joins no translations and returns NULL translated fields; conditions, sorts and aggregates on translated fields throwLogicException.TranslationStore::all($id)returns the translations of every locale of one owner, keyed by locale.- The
assigncallback of a relation is optional, for relations that are only filtered by or linked; loading such a relation throwsLogicExceptionbefore SQL. - A relation's target factory runs once per owner mapping instead of on every load, filter and link set.
- Reads without relation loads hydrate rows directly, every read releases rows as it goes, relation batches reuse one prepared target read, and
insertMany()no longer copies its rows.
Behavior changes
TranslationStore::save()andseed()insert only the given fields into a new translation row, so omitted fields take their column defaults instead of NULL. A translated column with a non-NULL default therefore keeps that default and does not fall back.Relation::$assignandMapping::$primaryKeyare nullable, andMapping::$generatedIdis false without a primary key.
Install
composer require 'solophp/repository:^1.0@RC'See the changelog for the full list of features and requirements, and the full diff since RC1.