Repository navigation
v2.1.0 adds API Platform 5 support, lets you stop translation reads from writing to the database, removes the N+1 on collections, and adds a configuration tree. There are no breaking changes.
See UPGRADE-2.1.md for the new options and the deprecations.
Highlights
API Platform 5 support (#89)
api-platform/symfony now allows ^3.4 || ^4.0 || ^5.0. No code changes were needed. CI now runs API Platform 5.x, 4.4 and 4.1. Thanks @mwansinck for the contribution.
Reads no longer have to write (#87)
Set auto_create_translations: false and getTranslation() stops creating and attaching a translation for a missing locale, so a GET can no longer insert empty translation rows (#55, #34). It returns a detached, never-persisted translation instead. Use the new getOrCreateTranslation() in your virtual setters:
# config/packages/api_platform_translation.yaml
api_platform_translation:
auto_create_translations: falseThe default stays true in 2.x. Not setting the option is deprecated, and 3.0 flips the default to false.
One query per collection (#88)
Translations of translatable resources are now fetch-joined, so listing N resources issues one query instead of one translation query per entity per locale (fixes #10). It is on by default and experimental. Disable it with eager_load_translations: false.
Configuration tree (#85)
New options under api_platform_translation: enabled_locales (inherits framework.enabled_locales when empty), fallback_locale (inherits framework.default_locale when null) and locale_resolution (ordered locale sources, query_param and accept_language). The bundle now extends AbstractBundle, and the Translator service can be autowired by type.
Deprecations
- Not setting
auto_create_translationsexplicitly: its default flips fromtruetofalsein 3.0. ApiPlatformTranslationExtension: the bundle registers its extension itself, removal in 3.0.
Full changelog: v2.0.1...v2.1.0