Skip to content

Conversation

@HecFranco
Copy link
Contributor

🎯 Purpose

This PR resolves critical deprecations that prevent the bundle from working with Symfony 8.0 while maintaining full backward compatibility with Symfony 7.x.

🔧 Changes

Service Configuration Migration

  • Migrated Resources/config/services.xmlResources/config/services.yaml
  • Resolves 13 deprecation warnings: Since symfony/dependency-injection 7.4: XML configuration format is deprecated
  • All service definitions now use YAML format as recommended by Symfony

DependencyInjection Updates

  • Updated LexikTranslationExtension to use YamlFileLoader instead of XmlFileLoader
  • Removed deprecated buildTranslatorDefinition() method
  • Service configuration now handled via YAML with proper autowiring

Composer Constraints

  • Updated all Symfony component constraints to ^7.0|^8.0:
    • symfony/asset
    • symfony/form
    • symfony/framework-bundle
    • symfony/security-csrf
    • symfony/translation
    • symfony/twig-bundle
    • symfony/validator
    • symfony/yaml

Translator Compatibility

  • Added TranslatorDecorator class for Symfony 8 compatibility (when Translator is final)
  • Maintains backward compatibility with Symfony 7.x
  • Service ID lexik_translation.translator continues to work as before

Event-Driven Resource Loading

  • Added DatabaseResourcesListener for event-driven database resource loading
  • Decouples resource loading logic from Translator

✅ Testing

  • PHPUnit tests pass on Symfony 7.4
  • PHPUnit tests pass on Symfony 8.0
  • No deprecation warnings
  • Backward compatibility verified

📝 Breaking Changes

None - This PR is fully backward compatible.

🔗 Related Issues

Fixes deprecations for Symfony 8.0 compatibility.

📚 Documentation

  • Service configuration format changed from XML to YAML (internal change only)
  • No user-facing changes required

- Migrate service configuration from XML to YAML
  * Resolves 13 deprecation warnings about XML format
  * Resources/config/services.xml → services.yaml
- Update DependencyInjection to use YamlFileLoader
- Update composer.json constraints to support Symfony ^7.0|^8.0
- Add TranslatorDecorator for Symfony 8 compatibility (when Translator is final)
- Add DatabaseResourcesListener for event-driven resource loading

This PR resolves critical deprecations that prevent the bundle from
working with Symfony 8.0 while maintaining full backward compatibility
with Symfony 7.x.

Closes: #XXX
- Add support for finding translator service by alias or class name
- Support named arguments in service definition
- Improve service locator registration
- Better compatibility with Symfony 8 service container
@bartmcleod
Copy link
Collaborator

@HecFranco Thank you for your contribution, it looks promising, but the CI fails as you can see. Probably easy to fix by adding the dependency.

Doctrine ORM requires symfony/var-exporter for LazyGhost support in PHP 8.4.
This fixes the test errors: 'Symfony LazyGhost is not available'.
@HecFranco
Copy link
Contributor Author

@bartmcleod It’s already been reviewed and uploaded, thanks.

…ansUnitRepository

- Improved flattening of locales array to handle both arrays of arrays and strings.
- Added logic to remove duplicate locales.
- Enhanced handling of MongoDB timestamp objects for createdAt and updatedAt fields in translation checks.
@bartmcleod bartmcleod merged commit 76650d5 into lexik:master Jan 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants