Skip to content

Conversation

@HecFranco
Copy link
Contributor

🎯 Purpose

This PR modernizes the codebase by replacing deprecated annotations and YAML configurations with PHP 8.1+ attributes, following Symfony best practices.

🔧 Changes

Commands

  • Replaced setName() method with #[AsCommand] attributes
    • ExportTranslationsCommand: Added name, description, and help attributes
    • ImportTranslationsCommand: Added name, description, and help attributes
  • Improved command documentation and help text

Controllers

  • Migrated from YAML routing to #[Route] attributes
    • TranslationController: All routes now use #[Route] attributes
    • RestController: All API routes now use #[Route] attributes
  • Removed dependency on Resources/config/routing.yml (now uses type: attribute)
  • Improved route organization and readability

Doctrine Entities

  • Migrated XML mappings to PHP attributes
    • Entity/Translation: Uses #[ORM\Entity], #[ORM\Column], #[ORM\ManyToOne], etc.
    • Entity/TransUnit: Uses #[ORM\Entity], #[ORM\Column], #[ORM\OneToMany], etc.
    • Entity/File: Uses #[ORM\Entity], #[ORM\Column], etc.
  • Removed XML mapping files (kept for backward compatibility during transition)

Doctrine Models

  • Migrated XML mappings to PHP attributes
    • Model/Translation: Uses #[ORM\MappedSuperclass] with attributes
    • Model/TransUnit: Uses #[ORM\MappedSuperclass] with attributes
    • Model/File: Uses #[ORM\MappedSuperclass] with attributes

Doctrine Mapping Pass

  • Updated RegisterMappingPass to support AttributeDriver
  • Maintains backward compatibility with XML mappings
  • Automatically detects and registers attribute-based mappings

✅ Testing

  • PHPUnit tests pass
  • Doctrine mappings work correctly
  • Routes work correctly
  • Commands work correctly
  • Backward compatibility maintained

📝 Breaking Changes

None - All changes are internal and maintain backward compatibility.

🔗 Related Issues

Modernizes codebase for PHP 8.1+ and Symfony best practices.

📚 Documentation

  • Commands, routes, and entities now use PHP attributes (internal change)
  • No user-facing changes required

- Commands: Replace setName() with #[AsCommand] attributes
  * ExportTranslationsCommand
  * ImportTranslationsCommand
- Controllers: Replace YAML routing with #[Route] attributes
  * TranslationController
  * RestController
- Doctrine Entities: Migrate XML mappings to PHP attributes
  * Entity/Translation, TransUnit, File
- Doctrine Models: Migrate XML mappings to PHP attributes
  * Model/Translation, TransUnit, File
- Update RegisterMappingPass to support attribute driver

All changes maintain backward compatibility and follow Symfony best
practices for PHP 8.1+.

Refs: #XXX
@bartmcleod
Copy link
Collaborator

@HecFranco The builds on this one don't pass either, maybe the same thing as your previous PR, which was successfully merged

- Introduced a new protected property `$file` in the Translation model.
- Added setter `setFile()` and getter `getFile()` methods for managing the file property.

This change enhances the Translation model by allowing the association of a file with each translation instance.
- Added a custom bridge network `lexik_translation_network` for service isolation.
- Updated `lexik_translation`, `mysql`, and `mongo` services to use the new network.
- Set environment variables for the `lexik_translation` service to enhance configuration.

These changes improve the Docker setup for the translation service, ensuring better network management and service communication.
@HecFranco
Copy link
Contributor Author

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

@bartmcleod bartmcleod merged commit 48811d4 into lexik:master Jan 26, 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