Skip to content

v1.0.0-RC2

Pre-release
Pre-release

Choose a tag to compare

@SoloPHP SoloPHP released this 21 Oct 15:09
· 18 commits to main since this release
64857aa

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 DBAL QueryBuilder with 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 with andWhere(), because where() replaces the criteria and visibility. It replaces v3's table() with applyCriteria().
  • Mappings without a primary key: Mapping::$primaryKey may be NULL for tables with composite keys. Their rows are read, inserted and changed by criteria, and operations by ID throw before SQL.
  • Translations::$defaultLocale is optional. Without it, a read that names no locale joins no translations and returns NULL translated fields; conditions, sorts and aggregates on translated fields throw LogicException.
  • TranslationStore::all($id) returns the translations of every locale of one owner, keyed by locale.
  • The assign callback of a relation is optional, for relations that are only filtered by or linked; loading such a relation throws LogicException before 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() and seed() 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::$assign and Mapping::$primaryKey are nullable, and Mapping::$generatedId is 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.