craue / CraueConfigBundle

Database-stored settings made available via a service for your Symfony project.
MIT License
173 stars 35 forks source link

Bundle only works with default entity manager not with multiple EntityManagers #44

Open sverraest opened 6 years ago

sverraest commented 6 years ago

We are using dynamic database connections for multiple tenant databases but it seems the bundle is coupled to use the default entity manager only.

When running the migration script for the db, even when specifying the em, it fails due to

...has a dependency on a non-existent service "doctrine.orm.default_entity_manager".

I can't immediately see a config setting to override this

imbachb commented 1 year ago

Might not help in OP's case but in my case, I could overwrite the configuration of craue_config_default and specify my non-default entity manager there:

services.yaml

services:
  craue_config_default:
    class: Craue\ConfigBundle\Util\Config
    public: true
    arguments:
      - '@craue_config_cache_adapter'
    calls:
      - setEntityManager: ['@doctrine.orm.universe_entity_manager']
      - setEntityName: ['%craue_config.entity_name%']

where universe was the name of the non-default entity manager.