我正在研究如何在Symfony 4.1中创建自定义包。我有一个简单的捆绑包,使用一个简单的控制器和一个路由/hello。我想创建一些Doctrine实体,以供包含我的捆绑包的外部应用程序使用。如何进行此配置和实体映射?遵循我当前的文件夹结构:
- custom-hello-bundle
- Controller
HelloController.php
- DependencyInjection
Configuration.php
CustomHelloExtension.php
- Resources
- config
routes.xml
services.xml
- Tests
composer.json
CustomHelloBundle.php
phpunit.xml.dist
我知道我必须创建一个Entity文件夹,并添加一个名为Hello.php的实体(例如)。但是我如何配置Doctrine来映射这个自定义捆绑包中的实体呢?
发布于 2018-06-06 09:06:01
您会对manual - Custom mapping entities in bundle的这一部分特别是这一部分感兴趣。
doctrine:
# ...
orm:
# ...
auto_mapping: true
mappings:
# ...
AppBundle:
type: xml
dir: SomeResources/config/doctrine
https://stackoverflow.com/questions/50708717
复制相似问题