in my Symfony 5 application I have an architecture like this:
src/
├─ Website/
│ ├─ Entity/
│ ├─ Repository/
│ ├─ Controller/
├─ Application/
│ ├─ Entity/
│ ├─ Repository/
│ ├─ Controller/
When I create an entity with the command php bin/console make:entity
, I would like to be able to specify on which folder to create the entity, and that it also creates the repository on the correct folder automatically.
Here is my configuration of the doctrine.yaml file
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App\Application:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Application/Entity'
prefix: 'App\Application\Entity'
alias: Application
App\Website:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Website/Entity'
prefix: 'App\Website\Entity'
alias: Website
For the moment, the only solution I have found is the following:
php bin/console make:entity
- I wait for it to ask me for the path, and I enter this if I want to create the entity Totoo in the
src/Application/Entity
folder :\App\Application\Entity\Totoo
- It does create the entity on
src/Application/Entity/Totoo.php
- But it will create the repository on
src/Repository/Application\Entity\TotooRepository.php
How could we optimize this way of creating entities with the command, in order to automatically create the entity and the repository in the right place, and if possible without having to type the full path each time? (Maybe thanks to the aliases in my doctrine setup? But I don't see how)