Symfony 4 make:entity {entity}在多个doctrine连接的自定义目录中生成

时间:2018-04-06 17:34:27

标签: php symfony doctrine symfony4

这里的symfony新手

我的config/packages/doctrine.yaml设置了两个连接。

Connection 1 is default; //connects to localhost:mysql:root:password:local_db
Connection 2 is remote; // connection to a server xxx.xxx.xx.xxx.:username:pwd:remote_db

是否可以使用cli工具php bin/console make:entity Product生成实体类,以在自定义目录中生成实体。

当我运行上述命令时,"产品" enttity类在我的src/Entity/目录中生成,但我希望它根据我们的需要生成,

所以我想在方案1中说我希望它在src/Entity/Customer/目录中生成实体类并且

方案2中的

我希望它在src/Entity/Products/目录中生成Entity类。如果我能够做到这一点,那么迁移和实体映射对我来说变得容易多了。

1 个答案:

答案 0 :(得分:5)

这有效: bin/console make:entity Customer\\Cart

created: src/Entity/Customer/Cart.php
created: src/Repository/Customer/CartRepository.php