make entities with multiple databases

时间:2018-12-19 11:25:00

标签: symfony doctrine-orm symfony4

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 个答案:

答案 0 :(得分:0)

Main 中创建 Product 实体的答案是:

php bin/console make:entity Main\\Product

并在 Customer 中创建 Customer 实体是:

php bin/console make:entity Customer\\Customer