简体   繁体   中英

Entity manager for specified entities

I have multiple managers and configuration of one of them is like this

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

But there are tens of entities in APIBundle and I need only some of them in this manager. What a correct configuration should be in such case?

I can't find anything in the doctrine documentation which match with what you're asking.

But by reading the mapping part , we can imagine a little trick to pass through that :

Define your entities in two distinct folders :

APIBundle
|
--- Em1Entity
|
--- SupportEntity

Then in your config, specify the dir configuration :

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

It's just a guess, I didn't personnaly tested this hack.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM