doctrine / DoctrineBundle

Symfony Bundle for Doctrine ORM and DBAL
https://www.doctrine-project.org/projects/doctrine-bundle.html
MIT License
4.72k stars 454 forks source link

"doctrine.orm.default_metadata_cache" does not exist #1376

Closed ghost closed 3 years ago

ghost commented 3 years ago

I've searched for a long time for the source of this problem as the error message appears in DependencyInjection\ContainerBuilder anywhere in the code.

Well I found out that the DoctrineExtension of this Bundle is doing something with that.

That problem occurred after upgrading Symfony from 4.1 to 4.4 I hope we can fix this somehow.

alcaeus commented 3 years ago

Please post a minimal example of a config that reproduces this. While the service name internally may have changed, the bundle should not be using old names when injecting services. If you are using the service in your own config, please don't as this service is very much internal to Doctrine and you shouldn't be working with it at all.

ghost commented 3 years ago

I haven't changed any config, I don't even have a metadata_cache service defined in doctrine. And also if I define a valid one it breaks with that message.

The Symfony upgrade forced me to use v2.4.2 instead of v1.9.x

Example config:

doctrine:
    orm:
        metadata_cache_driver:
          type: service
          id: Predis\Client
        query_cache_driver:
          type: service
          id: Predis\Client
        result_cache_driver:
          type: service
          id: Predis\Client
alcaeus commented 3 years ago

@ostrolucky is this the infamous "simplified config" here? I'd expect there to be an entity manager name involved 🤔

ostrolucky commented 3 years ago

No. @sdonner-mobiletrend please post a xml dump of your container from var/cache dir, at least.

ghost commented 3 years ago

sorry @ostrolucky but the error comes even before the app is able to write cache at all. I took the console command cache:warmup as test when the error appears, so my cache dir is pretty much empty.

Bildschirmfoto 2021-06-22 um 14 08 07
ostrolucky commented 3 years ago

Please downgrade so error is gone and post xml dump is that state, then. We just want to see what's requiring it

ghost commented 3 years ago

Please downgrade so error is gone and post xml dump is that state, then. We just want to see what's requiring it

well that's not easily possible I fear. I managed to get all dependencies compatible with #php8 and #symfony4.4 so downgrading is not an option but maybe why doctrine-bundle is getting us hopefully further?

Bildschirmfoto 2021-06-23 um 09 56 28
ostrolucky commented 3 years ago

Why is it not possible, are you not using GIT? Checkout master branch or previous commit when you didn't upgrade it yet...

ghost commented 3 years ago

Why is it not possible, are you not using GIT? Checkout master branch or previous commit when you didn't upgrade it yet...

sure ok, I checked out master and reinstalled php 7.2 what xml do you need now?

ostrolucky commented 3 years ago

there is only one xml file in var/cache/, isn't there?

ghost commented 3 years ago

there is only one xml file in var/cache/, isn't there?

Oh sure the appDevDebugPrjectContainer.xml that exposes my entire project you mean? are you serious?! Sorry but I would surely lose my job when I post that here. I can extract the bundles section or so if you want

ostrolucky commented 3 years ago

Look for doctrine.orm.default_metadata_cache inside that file and report the issue to whoever is maintaining that service. We don't use this in doctrine-bundle.

alcaeus commented 3 years ago

Oh sure the appDevDebugPrjectContainer.xml that exposes my entire project you mean? are you serious?! Sorry but I would surely lose my job when I post that here. I can extract the bundles section or so if you want

No, the xml file that is your compiled container. It doesn't "expose" anything. There's no logic and no data in that thing. Go ahead and make sure that no secrets are in the file, but unless you're willing to share some information to help us debug the issue, you shouldn't ask for help in a public forum.

If your code is so valuable and secret that you can't even share what is essentially a list of class names, I'm sure your company will pay for you to fix this issue for yourself and by yourself.

ghost commented 3 years ago

alright here you go then, hope it helps :) appDevDebugProjectContainer.xml.zip

ghost commented 3 years ago

Hey guys, hope you had a pleasant week. Is there any update to this by any chance? I might help you a lil but I currently have no Idea where to start..

ostrolucky commented 3 years ago

Only service using doctrine.orm.default_metadata_cache there is doctrine.orm.default_configuration. That's not very useful for us unfortunately, because we know that's not where problem is, otherwise more people would report the issue.

I'm afraid you will have to find the issue on your own, but I don't think it's an issue of doctrine-bundle. Hence closing. I will reconsider reopening this if you prove issue is in bundle and not your project.