Releases: Locastic/ApiPlatformTranslationBundle
Release list
v2.0.1
Patch release fixing a regression introduced by the translation write reconciliation in v2.0.0.
Fixed
Translations referenced by IRI (when the translation entity is exposed as its own ApiResource) are again resolved by API Platform's native denormalization (#83). v2.0.0 intercepted such payloads and silently dropped the references, which on PUT removed every existing translation.
The embedded locale-keyed shape documented in the README was not affected; if you only ever send "translations": {"en": {...}, "de": {...}}, v2.0.0 and v2.0.1 behave identically.
Full changelog: v2.0.0...v2.0.1
v2.0.0
v2.0.0 restores honest versioning and wide platform support after the mis-tagged v1.4.1, and fixes the long-standing translation write behavior.
See UPGRADE-2.0.md for step-by-step upgrade instructions.
Highlights
Translation writes reconciled in place (#81)
Nested translation writes no longer recreate the whole collection. Each submitted locale updates its existing translation row, keeping ids stable and unique constraints intact (fixes #61, the root cause behind #36 and #54):
PATCH(application/merge-patch+json) updates the submitted locales and leaves the others untouched. This is the recommended way to edit translations and needs no configuration.PUTis a full replace: locales absent from the payload are removed.PUTrequires API Platform'sstandard_putto be disabled, per operation (extraProperties: ['standard_put' => false]) or globally (api_platform.defaults.extra_properties.standard_put: false). A misconfiguredPUTfails with an explicit error telling you exactly that, instead of an obscure Doctrine exception.
Wide platform support restored (#76)
v1.4.1 silently raised the floor to PHP 8.4 and API Platform 4.2. v2.0.0 goes back to supporting the platforms the code actually runs on:
| v1.4 | v1.4.1 | v2.0.0 | |
|---|---|---|---|
| PHP | ^8.1 | >=8.4 | ^8.2 |
| API Platform | ^2.1 || ^3.0 | ^4.2 | ^3.4 || ^4.0 |
| Doctrine ORM | ^3.0 | ^3.5 | ^3.0 |
API Platform 2 users: stay on v1.4; critical fixes land on the new 1.x branch.
Locale validation (#71)
When framework.enabled_locales is configured, requested locales outside the list (?locale= or Accept-Language) now fall back to the default locale instead of being accepted verbatim. Thanks @maxhelias for the contribution.
Breaking changes
All breaking changes are listed in the CHANGELOG with upgrade steps in UPGRADE-2.0.md:
- Dependency floors (PHP ^8.2,
api-platform/symfony, Doctrine ORM 3). TranslatorimplementsLocaleAwareInterfaceand declares parameter types.AssignLocaleListenersignatures useDoctrine\Persistence\Event\LifecycleEventArgs.- Out-of-list locales fall back to the default locale when
enabled_localesis set. - Translation writes are reconciled in place;
PUTneedsstandard_putdisabled.
Quality
- PHPStan level 6 and php-cs-fixer enforced in CI (#78)
- CI matrix: PHP 8.2 to 8.5 plus a lowest-dependencies leg (#76)
- Model edge-case tests and a kernel smoke test booting Framework + Doctrine + API Platform (#80)
- Modernized README with attribute-based examples (#77), community files (#79)
Thanks to @maxhelias and @tacman for their contributions.
API Platform V4 and Symfony V7.4 support
What's Changed
- Update dependency for API Platform V4 and Symfony V7.4 by @nirav-programmer in #75
New Contributors
- @nirav-programmer made their first contribution in #75
Full Changelog: v1.4...v1.4.1
Doctrine 3.0 support
orm 3.0 support (#68) * oem3.0 support * bump php requirement to 8.1 * remove php 8.0 & add 8.3 in gh workflow
Translations loading improvement
Initialize proxy objects if necessary (#64) Co-authored-by: Alex C <alex.canals@jkweb.ch>
Handle doctrine/collection:^2
Handle doctrine/collection:^2
Support for PHP 8
Upgrade requirements to php8 (#39) * Upgrade requirements to php8 * Bump travis ci version to 8.0 * Bump travis ci version to 8.0 * Bump travis ci version to 8.0.2 * Bump travis ci ubuntu version to xenial
Minor fixes
- fix conflicts with symfony/translations-contracts <2.0
- fixed doctrine listener arguments for new doctrine version
- small code cleanup
Strict types fixes and documentation improvements
Improve documentation and update PhpDoc and method signatures (#22) * Add missing information about Doctrine relationship. * Don't allow empty parameter on setters of Translation objects. * Cleanup some PhpDoc and method signatures * Update README.md Co-authored-by: Ashura <dominik.mueller@jkweb.ch>
Fixed default locale parameter and added symfony-bundle tag
- added tag "type": "symfony-bundle" to composer.json
- switched "locale" parameter in services.yml to "kernel.default_locale"