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

Error thrown while running command "cache:warmup" #378

Closed
ufeldmann opened this issue Nov 26, 2024 · 6 comments
Closed

Error thrown while running command "cache:warmup" #378

ufeldmann opened this issue Nov 26, 2024 · 6 comments

Comments

@ufeldmann
Copy link

Notification Center: 2.2.0
Contao Version: 4.13.50
PHP Version: 8.1.13

After I updated the dependencies to 2.2.0 the cache warm up throws an error.
I also deleted the cache manually and also deleted the vendor folder. But the error still occurs.
With Version 2.1.1 everything works.


 // Warming up the cache for the dev environment with debug true                                                        

09:01:24 CRITICAL  [console] Error thrown while running command "cache:warmup -v". Message: "Call to a member function load() on bool" ["exception" => Error { …},"command" => "cache:warmup -v","message" => "Call to a member function load() on bool"]

In Plugin.php line 31:
                                            
  [Error]                                   
  Call to a member function load() on bool  
                                            

Exception trace:
  at /projectfolder/vendor/terminal42/notification_center/src/ContaoManager/Plugin.php:31
 Terminal42\NotificationCenterBundle\ContaoManager\Plugin->getRouteCollection() at /projectfolder/vendor/contao/manager-bundle/src/Routing/RouteLoader.php:61
 Contao\ManagerBundle\Routing\RouteLoader->Contao\ManagerBundle\Routing\{closure}() at n/a:n/a
 array_reduce() at /projectfolder/vendor/contao/manager-bundle/src/Routing/RouteLoader.php:58
 Contao\ManagerBundle\Routing\RouteLoader->loadFromPlugins() at /projectfolder/vendor/symfony/routing/Loader/ObjectLoader.php:62
 Symfony\Component\Routing\Loader\ObjectLoader->load() at /projectfolder/vendor/symfony/config/Loader/DelegatingLoader.php:40
 Symfony\Component\Config\Loader\DelegatingLoader->load() at /projectfolder/vendor/symfony/framework-bundle/Routing/DelegatingLoader.php:70
 Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader->load() at /projectfolder/vendor/symfony/framework-bundle/Routing/Router.php:68
 Symfony\Bundle\FrameworkBundle\Routing\Router->getRouteCollection() at /projectfolder/vendor/symfony/routing/Router.php:361
 Symfony\Component\Routing\Router->getMatcherDumperInstance() at /projectfolder/vendor/symfony/routing/Router.php:289
 Symfony\Component\Routing\Router->Symfony\Component\Routing\{closure}() at /projectfolder/vendor/symfony/config/ResourceCheckerConfigCacheFactory.php:39
 Symfony\Component\Config\ResourceCheckerConfigCacheFactory->cache() at /projectfolder/vendor/symfony/routing/Router.php:287
 Symfony\Component\Routing\Router->getMatcher() at /projectfolder/vendor/symfony/framework-bundle/Routing/Router.php:97
 Symfony\Bundle\FrameworkBundle\Routing\Router->warmUp() at /projectfolder/vendor/symfony-cmf/routing/src/ChainRouter.php:344
 Symfony\Cmf\Component\Routing\ChainRouter->warmUp() at /projectfolder/vendor/symfony/framework-bundle/CacheWarmer/RouterCacheWarmer.php:45
 Symfony\Bundle\FrameworkBundle\CacheWarmer\RouterCacheWarmer->warmUp() at /projectfolder/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php:99
 Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() at /projectfolder/vendor/symfony/framework-bundle/Command/CacheWarmupCommand.php:83
 Symfony\Bundle\FrameworkBundle\Command\CacheWarmupCommand->execute() at /projectfolder/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at /projectfolder/vendor/symfony/console/Application.php:1058
 Symfony\Component\Console\Application->doRunCommand() at /projectfolder/vendor/symfony/framework-bundle/Console/Application.php:96
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /projectfolder/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at /projectfolder/vendor/symfony/framework-bundle/Console/Application.php:82
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /projectfolder/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at /projectfolder/vendor/contao/manager-bundle/bin/contao-console:38
 include() at /projectfolder/vendor/bin/contao-console:119
@Toflar
Copy link
Member

Toflar commented Nov 26, 2024

Cannot reproduce, looks like this is likely only an issue in 4.13 - probably because of annotations.
@aschempp any idea how https://github.com/terminal42/contao-notification_center/blob/main/src/ContaoManager/Plugin.php#L30 should look so it works in 4.13 as well? I specifically only want to load that file and not any subdirectories.

@fritzmg
Copy link
Collaborator

fritzmg commented Nov 26, 2024

As far as I know the issue is that you cannot stay compatible across Symfony 5, 6 & 7 here. In Symfony 5 you must use annotation (which will also support PHP attributes) and in Symfony 7 you must use attribute.

You could require symfony/routing: ^5.4 || ^6.4 and then use annotation - but that of course means anyone installing NC 2.2.x will need to downgrade Symfony from 7 to 6 in Contao 5.4.

Or you define the routes specifically of course, instead of using annotations or attributes.

@luhmannAlexander
Copy link

Same here.

Notification Center: 2.2.0
Contao Version: 4.13.50
PHP Version: 8.2

What is the last version with annotation?

@fritzmg
Copy link
Collaborator

fritzmg commented Nov 26, 2024

@luhmannAlexander just add a "terminal42/notification_center": "2.2.0" conflict to your composer.json, then run composer update again.

@aschempp
Copy link
Member

see #379 for the fix

@luhmannAlexander
Copy link

Thanks for the quick help.

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