Skip to content
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.

Break, when ORM, or PHPCR is installed, but not enabled #44

Closed
kingcrunch opened this issue Aug 31, 2013 · 3 comments
Closed

Break, when ORM, or PHPCR is installed, but not enabled #44

kingcrunch opened this issue Aug 31, 2013 · 3 comments

Comments

@kingcrunch
Copy link

Currently the bundle only test, if the class exists:

    $useOrm = 'auto' == $config['cache_invalidation']['orm_listener'] ?
        class_exists('Doctrine\\ORM\\Version') :
        $config['cache_invalidation']['orm_listener'];
    if ($useOrm) {
        $loader->load('orm.xml');
    }
    $usePhpcrOdm = 'auto' == $config['cache_invalidation']['phpcr_odm_listener'] ?
        class_exists('Doctrine\\PHPCR\\ODM\\Version') :
        $config['cache_invalidation']['phpcr_odm_listener'];
    if ($usePhpcrOdm) {
        $loader->load('phpcr_odm.xml');
    }

This is unreliable and will break, if the bundle exists, but isn't enabled. Of course I can set orm_listener/phpcr_odm_listener manually to false (from auto), but that is usually not something somebody expect from an automation.

@dbu
Copy link
Contributor

dbu commented Sep 1, 2013

well yes, that is the point of auto but keeping the option to explicitly set false. i don't know if we could improve by checking if the kernel knows about the orm / phpcr bundle. at some places, there is code in the cmf where we get the list of bundle names from the kernel and check those, instead of class_exists. if you have a PR for that, it would make sense imo. otherwise its just that for a weird edge case (having the code in classpath but not enabled the bundle) you need to configure something more.

@kingcrunch
Copy link
Author

If I am not completely wrong one can get the registered bundles with $container->getParameter('kernel.bundles'). I've already seen something different somewhere else (afair it was about prependConfiguration() somehow ❓ ). So I think somehow it is possible

I don't know, if it's a werid edge-case 😉 But I often disable bundles first and test it, before I remove them completely.
Another case would be (also: Don't know, how common this is), if someone has multiple applications within one project.

So, as far as I can see it shouldn't be that complicated. Don't know, when I find some time for that 😉

@kingcrunch
Copy link
Author

Well... Wanted to provide a PR, but then I realize: It (the snippet I complained about) doesn't depend on a bundle, thus my approach isn't valid. I'm still convinced, that it requires the corresponding bundles, but I'm not sure.

Sorry for he noise 😸

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

No branches or pull requests

2 participants