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

Attempted to call an undefined method named "getCacheDriver" #1514

Closed
topwebstudio opened this issue Apr 29, 2022 · 5 comments
Closed

Attempted to call an undefined method named "getCacheDriver" #1514

topwebstudio opened this issue Apr 29, 2022 · 5 comments

Comments

@topwebstudio
Copy link

topwebstudio commented Apr 29, 2022

After upgrading to "doctrine/doctrine-bundle": "2.6.3" the following error occured

Attempted to call an undefined method named "getCacheDriver" of class "Doctrine\Bundle\DoctrineBundle\Mapping\ClassMetadataFactory".

  • Upgrading doctrine/persistence (2.5.1 => 3.0.0): Extracting archive
  • Upgrading doctrine/doctrine-bundle (2.6.2 => 2.6.3): Extracting archive
  • Downgrading gedmo/doctrine-extensions (v3.6.0 => v3.1.0): Extracting archive

If I switch back to 2.6.2 works ok.

@ostrolucky
Copy link
Member

can you include full stack trace please

@geoffroyp
Copy link

geoffroyp commented Apr 29, 2022

I'm having the same probleme here. I've been able to isolate the fact this bug is related to a combination of doctrine/persistence and gedmo/doctrine-extensions. I have updated all the others bundles without any problem, but once I update these two, it crashes.

I have tried to update only one of them, but then composer says it's up-to-date and that it doesn't need to be updated. But when I run composer update again, it still tries to update them

so here's what remain from my composer update dry run

Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Restricting packages listed in "symfony/symfony" to "6.0.*"
Updating dependencies
Lock file operations: 0 installs, 2 updates, 0 removals
  - Upgrading doctrine/persistence (2.5.1 => 3.0.0)
  - Downgrading gedmo/doctrine-extensions (v3.6.0 => v3.1.0)
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 2 updates, 0 removals
  - Upgrading doctrine/persistence (2.5.1 => 3.0.0)
  - Downgrading gedmo/doctrine-extensions (v3.6.0 => v3.1.0)
122 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

here a full stack as you request:

                                                                                                                                        
  [Symfony\Component\ErrorHandler\Error\UndefinedMethodError]                                                                           
  Attempted to call an undefined method named "getCacheDriver" of class "Doctrine\Bundle\DoctrineBundle\Mapping\ClassMetadataFactory".  
                                                                                                                                        

Exception trace:
  at /var/www/api/vendor/gedmo/doctrine-extensions/src/Mapping/ExtensionMetadataFactory.php:104
 Gedmo\Mapping\ExtensionMetadataFactory->getExtensionMetadata() at /var/www/api/vendor/gedmo/doctrine-extensions/src/Mapping/MappedEventSubscriber.php:201
 Gedmo\Mapping\MappedEventSubscriber->loadMetadataForObjectClass() at /var/www/api/vendor/gedmo/doctrine-extensions/src/AbstractTrackingListener.php:44
 Gedmo\AbstractTrackingListener->loadClassMetadata() at /var/www/api/vendor/symfony/doctrine-bridge/ContainerAwareEventManager.php:66
 Symfony\Bridge\Doctrine\ContainerAwareEventManager->dispatchEvent() at /var/www/api/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:225
 Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata() at /var/www/api/vendor/doctrine/doctrine-bundle/Mapping/ClassMetadataFactory.php:18
 Doctrine\Bundle\DoctrineBundle\Mapping\ClassMetadataFactory->doLoadMetadata() at /var/www/api/vendor/doctrine/persistence/src/Persistence/Mapping/AbstractClassMetadataFactory.php:315
 Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata() at /var/www/api/vendor/doctrine/persistence/src/Persistence/Mapping/AbstractClassMetadataFactory.php:183
 Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor() at /var/www/api/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:313
 Doctrine\ORM\EntityManager->getClassMetadata() at /var/www/api/vendor/doctrine/doctrine-bundle/Repository/ContainerRepositoryFactory.php:40
 Doctrine\Bundle\DoctrineBundle\Repository\ContainerRepositoryFactory->getRepository() at /var/www/api/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:816
 Doctrine\ORM\EntityManager->getRepository() at /data/symfony_var/dev/cache/ContainerZm4QReJ/EntityManager_9a5be93.php:227
 ContainerZm4QReJ\EntityManager_9a5be93->getRepository() at /var/www/api/src/Command/MyAwesomeCommand.php:64
 App\Command\MyAwesomeCommand->execute() at /var/www/api/vendor/symfony/console/Command/Command.php:291
 Symfony\Component\Console\Command\Command->run() at /var/www/api/vendor/symfony/console/Application.php:1007
 Symfony\Component\Console\Application->doRunCommand() at /var/www/api/vendor/symfony/framework-bundle/Console/Application.php:94
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /var/www/api/vendor/symfony/console/Application.php:299
 Symfony\Component\Console\Application->doRun() at /var/www/api/vendor/symfony/framework-bundle/Console/Application.php:80
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/api/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at /var/www/api/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:54
 Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run() at /var/www/api/vendor/autoload_runtime.php:29
 require_once() at /var/www/api/bin/console:11

@ostrolucky
Copy link
Member

well there you go, it's issue in gedmo extensions which doesn't seem to work with persistence 3.0. Not an issue in doctrine-bundle.

@dmaicher
Copy link
Contributor

To me this seems to be an issue with gedmo/doctrine-extensions then.

See https://github.com/doctrine/persistence/blob/2.5.x/src/Persistence/Mapping/AbstractClassMetadataFactory.php#L99

Seems incompatible with persistence 3

@KaiGrassnick
Copy link

Temporary Workaround (at least for me)

  1. composer require doctrine/persistence ^2.2
  2. composer require gedmo/doctrine-extensions ^3.6

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

5 participants