swarrot / SwarrotBundle

A symfony bundle for swarrot integration
MIT License
89 stars 59 forks source link

Update processor for doctrine/persistence:^2.0 #202

Closed lepiaf closed 4 years ago

lepiaf commented 4 years ago

Hello,

We've encounter this error in our app.

Symfony\Component\Debug\Exception\FatalThrowableError^ {#2714
  -originalClassName: "TypeError"
  #message: "Argument 2 passed to Swarrot\SwarrotBundle\Processor\Doctrine\ObjectManagerProcessorConfigurator::__construct() must be an instance of Doctrine\Common\Persistence\ManagerRegistry, instance of Doctrine\Bundle\MongoDBBundle\ManagerRegistry given, called in /var/www/MY_APP/var/cache/dev/ContainerE16VOet/getSwarrot_Command_Generated_RequestReportService.php on line 68"
  #code: 0
  #file: "/var/www/MY_APP/vendor/swarrot/swarrot-bundle/Processor/Doctrine/ObjectManagerProcessorConfigurator.php"
  #line: 22
  #severity: E_RECOVERABLE_ERROR
  trace: {
    /var/www/MY_APP/vendor/swarrot/swarrot-bundle/Processor/Doctrine/ObjectManagerProcessorConfigurator.php:22 { …}
    /var/www/MY_APP/var/cache/dev/ContainerE16VOet/getSwarrot_Command_Generated_RequestReportService.php:68 {
      ContainerE16VOet\getSwarrot_Command_Generated_RequestReportService::do($container, $lazyLoad = true)^
      › 
      › $i = new \Swarrot\SwarrotBundle\Processor\Doctrine\ObjectManagerProcessorConfigurator('Swarrot\\Processor\\Doctrine\\ObjectManagerProcessor', $h);
      › $i->setExtras([]);
      arguments: {
        $processorClass: "Swarrot\Processor\Doctrine\ObjectManagerProcessor"
        $managerRegistry: Doctrine\Bundle\MongoDBBundle\ManagerRegistry {#522 …}
      }
    }
    /var/www/MY_APP/var/cache/dev/ContainerE16VOet/App_KernelDevDebugContainer.php:197 { …}
    /var/www/MY_APP/vendor/symfony/dependency-injection/Container.php:441 { …}
    /var/www/MY_APP/vendor/symfony/dependency-injection/Argument/ServiceLocator.php:40 { …}
    /var/www/MY_APP/vendor/symfony/console/CommandLoader/ContainerCommandLoader.php:45 { …}
    /var/www/MY_APP/vendor/symfony/console/Application.php:527 { …}
    /var/www/MY_APP/vendor/symfony/console/Application.php:616 { …}
    /var/www/MY_APP/vendor/symfony/framework-bundle/Console/Application.php:116 { …}
    /var/www/MY_APP/vendor/symfony/console/Application.php:230 { …}
    /var/www/MY_APP/vendor/symfony/framework-bundle/Console/Application.php:82 { …}
    /var/www/MY_APP/vendor/symfony/console/Application.php:142 { …}
    /var/www/MY_APP/bin/console:42 { …}
  }
}

Namespace Doctrine\Common\Persistence has been removed in doctrine/persistence lib in v2 https://github.com/doctrine/persistence/pull/106 https://github.com/doctrine/persistence/releases/tag/2.0.0

I've updated processor to be compatible with new version of lib.

stof commented 4 years ago

this requires adding a conflict rule with doctrine/persistence < 1.3 (to be checked whether the first version including the new namespace is 1.3 or 1.4, as I'm not sure about that)

odolbeau commented 4 years ago

Thanks for your contribution @lepiaf! :ok_hand: (& thanks @stof for your review!)