Symfony 4 make:entity {entity} 在多学说连接的自定义目录中生成
Symfony 4 make:entity {entity} generate in a custom directory in a multi doctrine connection
这里是 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
生成实体 class 在自定义目录中生成实体。
当我运行上面的命令时,"Product"实体class在我的src/Entity/
目录中生成,但我希望它根据我们的需要生成,
所以假设在场景 1 中我希望它在 src/Entity/Customer/
目录和
中生成实体 class
在场景 2 中,我希望它在 src/Entity/Products/
目录中生成实体 class。如果我能够做到这一点,那么迁移和实体映射对我来说就会变得容易得多。
这个有效:
bin/console make:entity Customer\Cart
:
created: src/Entity/Customer/Cart.php
created: src/Repository/Customer/CartRepository.php
这里是 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
生成实体 class 在自定义目录中生成实体。
当我运行上面的命令时,"Product"实体class在我的src/Entity/
目录中生成,但我希望它根据我们的需要生成,
所以假设在场景 1 中我希望它在 src/Entity/Customer/
目录和
在场景 2 中,我希望它在 src/Entity/Products/
目录中生成实体 class。如果我能够做到这一点,那么迁移和实体映射对我来说就会变得容易得多。
这个有效:
bin/console make:entity Customer\Cart
:
created: src/Entity/Customer/Cart.php
created: src/Repository/Customer/CartRepository.php