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

prependExtensionConfig: define doctrine settings over multiple bundles #23467

Closed
dominikzogg opened this issue Jul 10, 2017 · 4 comments
Closed

Comments

@dominikzogg
Copy link

dominikzogg commented Jul 10, 2017

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.2.11

We've got a bundle (base bundle) which delivers basic doctrine settings by prependExtensionConfig. Which worked fine since years. Today i tried to register a new doctrine (dbal) field type.

After i add it to the 'dbal' section of the doctrine settings. Every bundle depends on base bundle and got additional doctrine settings failed by: Unknown database 'xxxx'

Does not work

BaseBundle

$container->prependExtensionConfig(
    'doctrine',
    [
        'dbal' => [
            'types' => [
                PartialDateType::NAME => [
                    'class' => PartialDateType::class
                ]
            ]
        ],
        'orm' => [...]
    ]
);

FeatureBundle

$container->prependExtensionConfig(
    'doctrine',
    [
        'orm' => [...]
    ]
);

=> Unknown database 'xxxx'

Does work (without type)

BaseBundle

$container->prependExtensionConfig(
    'doctrine',
    [
        'orm' => [...]
    ]
);

FeatureBundle

$container->prependExtensionConfig(
    'doctrine',
    [
        'orm' => [...]
    ]
);
@sstok
Copy link
Contributor

sstok commented Jul 10, 2017

Doctrine has it's own bundle https://github.com/doctrine/DoctrineBundle

@stof
Copy link
Member

stof commented Jul 10, 2017

Several solutions:

The future-proof option is the first one. doctrine/DoctrineBundle#628 is preparing the deprecation of the old way, as it causes issues, which was revealed by a recent bugfix triggering the early registration more often (previously, registration was missed in some cases, like yours).
Configuring the server_version explicitly is still worth it though.

@xabbuh
Copy link
Member

xabbuh commented Jul 10, 2017

I am closing here anyway as the issue is related to DoctrineBundle.

@xabbuh xabbuh closed this as completed Jul 10, 2017
@dominikzogg
Copy link
Author

dominikzogg commented Jul 11, 2017

@stof thank you, works like a charm (first suggestion)

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

No branches or pull requests

4 participants