Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default_entity_manager config param is not inherited from parent config file #1337

Closed
bravik opened this issue May 3, 2021 · 2 comments · Fixed by #1648
Closed

default_entity_manager config param is not inherited from parent config file #1337

bravik opened this issue May 3, 2021 · 2 comments · Fixed by #1648

Comments

@bravik
Copy link

bravik commented May 3, 2021

This line in Configuratation:

$v['default_entity_manager'] = isset($v['default_entity_manager']) ? (string) $v['default_entity_manager'] : 'default';

makes default_entity_manager (=<some_none_default_value>) param defined in config/packages/doctrine.yml
been overriden by config/packages/prod/doctrine.yml without this option.
Instead of the value from config/packages/doctirne.yml we have default value.
Which is conter-intuitive and took a couple of time to investigate mapping issues.

Example:

#c onfig/packages/doctrine.yml
doctrine:
  # ...
    orm:
        auto_generate_proxy_classes: true
        default_entity_manager: app
        entity_managers:
            app:
               # ...
            module:
               #...
#config/packages/prod/doctrine.yml
# The default one, generated by flex

doctrine:
    orm:
        auto_generate_proxy_classes: false
        metadata_cache_driver:
            type: pool
            pool: doctrine.system_cache_pool
        query_cache_driver:
            type: pool
            pool: doctrine.system_cache_pool
        result_cache_driver:
            type: pool
            pool: doctrine.result_cache_pool

Expected: app
Given: default

@ostrolucky
Copy link
Member

Can be also tested via bin/console debug:container --parameter=doctrine.default_entity_manager --env=prod and bin/console debug:container --parameter=doctrine.default_entity_manager --env=dev, respectively.

If anyone want to work on this, I think solution would be to extract this normalization

$v['default_entity_manager'] = isset($v['default_entity_manager']) ? (string) $v['default_entity_manager'] : 'default';
$v['entity_managers'] = [$v['default_entity_manager'] => $entityManager];
to DoctrineExtension

@ostrolucky ostrolucky changed the title default_entity_manager config param is been set to default by env-specific config file, without this param. default_entity_manager config param is not inherited from parent config file May 25, 2021
@ostrolucky ostrolucky added this to the 2.4.0 milestone May 25, 2021
@ostrolucky
Copy link
Member

Patch has been merged into 2.4. It should prevent similar issues in future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants