Symfony 指定实体的实体管理器

Symfony 指定实体的实体管理器,symfony,doctrine-orm,configuration,entitymanager,Symfony,Doctrine Orm,Configuration,Entitymanager,我有多个管理器,其中一个的配置如下 doctrine: orm: entity_managers: support: connection: support mappings: APIBundle: ~ 但是APIBundle中有几十个实体,我只需要在这个管理器中使用其中的一些。在这种情况下,正确的配置应该是什么?我在条令文档中找不到任何与您要求的匹配的内容 但是通过阅读,我们可以想象一个小技巧来通过它: 在两个不同的

我有多个管理器,其中一个的配置如下

doctrine:
  orm:
    entity_managers:
      support:
        connection: support
        mappings:
          APIBundle: ~

但是APIBundle中有几十个实体,我只需要在这个管理器中使用其中的一些。在这种情况下,正确的配置应该是什么?

我在条令文档中找不到任何与您要求的匹配的内容

但是通过阅读,我们可以想象一个小技巧来通过它:

在两个不同的文件夹中定义实体:

APIBundle
|
--- Em1Entity
|
--- SupportEntity
然后在配置中,指定
dir
配置:

doctrine:
  orm:
    entity_managers:
      support:
        connection: support
        mappings:
          Support:
            mapping:              true
            type:                 ~
            dir:                  APIBundle\SupportEntity
            alias:                ~
            prefix:               ~
            is_bundle:            ~ 

这只是一个猜测,我没有亲自测试过这个黑客。

我在条令文档中找不到任何与你所问相符的东西

但是通过阅读,我们可以想象一个小技巧来通过它:

在两个不同的文件夹中定义实体:

APIBundle
|
--- Em1Entity
|
--- SupportEntity
然后在配置中,指定
dir
配置:

doctrine:
  orm:
    entity_managers:
      support:
        connection: support
        mappings:
          Support:
            mapping:              true
            type:                 ~
            dir:                  APIBundle\SupportEntity
            alias:                ~
            prefix:               ~
            is_bundle:            ~ 
这只是猜测,我没有亲自测试这个黑客