问题
I have to do large refactoring/enhancements on web apps. We decided to use Symfony4.
I want to define 2 (or more) databases: the old one and the new one.
(In the future, I think to have more location
, person
databases common at several web apps)
In my researches, I use Multiple Entity Managers, create my databases as mentionned, then create my src/Entity/Main
and src/Entity/Customer
folders.
Then, I want to create my entities, especially new one with php bin/console make:entity
but it creates files in Entity
folder, not in Entity/Main
(default) or Customer
and returns
[ERROR] Only annotation mapping is supported by make:entity
Are there any solution to use this make:entity
command or should I define all entity files myself?
Nota: I don't put my config/packages/doctrine.yaml
, it is the same as in help sample except server_version: '5.6' to be compliant with my MariaDB version
回答1:
The answer to create Product entity in Main is:
php bin/console make:entity Main\\Product
and to create Customer entity in Customer is:
php bin/console make:entity Customer\\Customer
来源:https://stackoverflow.com/questions/53850235/make-entities-with-multiple-databases