Answer the question
In order to leave comments, you need to log in
Split the mapping structure into folders and subfolders?
According to the documentation, all files that are in the folder are mapped by files. However, what if I already have 400+ files there? I would like to split it into folders and subfolders, but it gives an error that there is no mapping file if we transfer it to the sub directory of the mapping folder.
At the moment, taken from here https://stackoverflow.com/questions/38008997/can-i... so far I do this, for each pack of related mappings, I create another mapping in the configuration.
mappings:
User:
is_bundle: false
type: xml
dir: '%kernel.project_dir%/src/Infrastructure/Mappings/User'
prefix: 'App\Domain\User'
alias: User
Role:
is_bundle: false
type: xml
dir: '%kernel.project_dir%/src/Infrastructure/Mappings/Role'
prefix: 'App\Domain\Role'
alias: Role
...
Answer the question
In order to leave comments, you need to log in
See an example here: https://symfony.com/doc/current/configuration/micr...
It shows how to load a container configuration using PHP (see the configureContainer method)
// Сначала вам нужно прочитать все директории с файлами мэппинга
// и сделать из них массив
foreach ($paths as $dir) {
$mappings[$dir] = [
'is_bundle' => false,
// ...
];
}
// А потом загрузить его в контейнер
$c->loadFromExtension('doctrine', [
'orm' => [
'mappings' => $mappings
]
)]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question