DoctrineBundle: composer cache:clear fails since upgrading DoctrineBundle 2.5.7->2.6.0

I ran composer upgrade:

Lock file operations: 0 installs, 1 update, 0 removals
  - Upgrading doctrine/doctrine-bundle (2.5.7 => 2.6.0)

I got :

Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 255
!!  Symfony\Component\ErrorHandler\Error\UndefinedMethodError {#65817
!!    #message: "Attempted to call an undefined method named "setMiddlewares" of class "Doctrine\DBAL\Configuration"."
!!    #code: 0
!!    #file: "./var/cache/dev/ContainerMFCvxZk/App_KernelDevDebugContainer.php"
!!    #line: 1267
!!    trace: {
!!      ./var/cache/dev/ContainerMFCvxZk/App_KernelDevDebugContainer.php:1267 {
!!        ContainerMFCvxZk\App_KernelDevDebugContainer->getDoctrine_Dbal_DefaultConnectionService()
!!        › $a->setSchemaAssetsFilter(new \Doctrine\Bundle\DoctrineBundle\Dbal\SchemaAssetsFilterManager([0 => ($this->privates['doctrine.dbal.well_known_schema_asset_filter'] ?? ($this->privates['doctrine.dbal.well_known_schema_asset_filter'] = new \Doctrine\Bundle\DoctrineBundle\Dbal\BlacklistSchemaAssetFilter([0 => 'cache_items', 1 => 'sessions']))), 1 => new \Doctrine\Bundle\DoctrineBundle\Dbal\RegexSchemaAssetFilter('~^(?!(import\\.|reporting\\.|sqitch\\.|accounting\\.|history\\.|topology\\.|tiger\\.|tiger_data\\.))~')]));
!!        › $a->setMiddlewares([]);
!!        ›
!!      }
!!      ./var/cache/dev/ContainerMFCvxZk/App_KernelDevDebugContainer.php:1508 { …}
!!      ./var/cache/dev/ContainerMFCvxZk/App_KernelDevDebugContainer.php:1282 { …}
!!      ./var/cache/dev/ContainerMFCvxZk/EntityManager_9a5be93.php:246 { …}
!!      ./var/cache/dev/ContainerMFCvxZk/EntityManager_9a5be93.php:246 { …}
!!      ./vendor/symfony/doctrine-bridge/CacheWarmer/ProxyCacheWarmer.php:54 { …}
!!      ./vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php:98 { …}
!!      ./vendor/symfony/http-kernel/Kernel.php:584 { …}
!!      ./vendor/symfony/http-kernel/Kernel.php:786 { …}
!!      ./vendor/symfony/http-kernel/Kernel.php:125 { …}
!!      ./vendor/symfony/framework-bundle/Console/Application.php:168 { …}
!!      ./vendor/symfony/framework-bundle/Console/Application.php:74 { …}
!!      ./vendor/symfony/console/Application.php:167 { …}
!!      ./vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:56 { …}
!!      ./vendor/autoload_runtime.php:35 { …}
!!      ./bin/console:11 { …}
!!    }
!!  }
!!  2022-03-30T09:31:06+00:00 [critical] Uncaught Error: Call to undefined method Doctrine\DBAL\Configuration::setMiddlewares()
!!
Script @auto-scripts was called via post-update-cmd

Is there something I need to configure here?

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 17 (8 by maintainers)

Most upvoted comments

Ok so I see 2 options:

  • report this issue on sentry-symfony as they really should not alias/define a Doctrine DBAL interface…
  • we look into changing the “middleware avaiable detection” on our side here so it works with Sentry

I personally would vote for the first option as this alias magic can really cause a lot of confusion and what the f**k moments as we see here.

thanks, I’ll report it to them now

Are you by any chance using Sentry?

It seems there is some weird stuff happening with class aliases:

https://github.com/getsentry/sentry-symfony/blob/master/src/aliases.php#L111

Yes, I can confirm, we are using Sentry in our project

Issue not caused on our side

Are you by any chance using Sentry? It seems there is some weird stuff happening with class aliases: https://github.com/getsentry/sentry-symfony/blob/master/src/aliases.php#L111

Yes, I can confirm, we are using Sentry in our project

my project also uses sentry via sentry-symfony

Introduced with https://github.com/doctrine/DoctrineBundle/pull/1472

Middleware feature introduced in doctrine/dbal:3.0.0. Probably bundle should configure middlewares only in case of installed doctrine/dbal 3+.