Question

I installed FOS Userbundle to learn from it, but decided I didn't need it anymore. I then did the following to remove it. After removing, I ran composer update.

  • removed the bundle from the vendor folder
  • removed from the appKernel
  • removed from the composer.json file
  • removed the entity User.php file
  • removed the settings from config.yml, security.yml, routing.yml

Now when I attempt to clear cache for production mode I get the following error below. Clearing cache in dev mode works fine.

Can show me what I am doing wrong or what I am missing to remove FOS User Bundle and be able to clear cache in production mode?

PHP Fatal error:  Class 'FOS\UserBundle\EventListener\LastLoginListener' not found in /var/www/html/HealthFitness/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php on line 142

PHP Stack trace:

PHP   1. {main}() /var/www/html/HealthFitness/app/console:0

PHP   2. Symfony\Component\Console\Application->run() /var/www/html/HealthFitness/app/console:27

PHP   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/html/HealthFitness/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:121

PHP   4. Symfony\Component\DependencyInjection\Container->get() /var/www/html/HealthFitness/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:86

PHP   5. appProdProjectContainer->getEventDispatcherService() /var/www/html/HealthFitness/app/bootstrap.php.cache:2037

PHP   6. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->addSubscriberService() /var/www/html/HealthFitness/app/cache/prod/appProdProjectContainer.php:343
Was it helpful?

Solution

Your error indeed probably come from a cache error.

Have you this error executing php app/console cache:clear --env=prod ?

You can else delete app/cache/prod/* manually.

OTHER TIPS

In case you can't remove the files manually this should work as well.

You could also use a --no-warmup and --no-optional-warmers switches:

cache:clear --no-warmup --no-optional-warmers --env=prod

that way it should not try to recreate the cache of non existing classes and then do a

cache:warmup --env=prod

Manually removing cache is faster though, but you still warm it up.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top