Search code examples
symfonyfosuserbundleproduction-environmentremoveallclear-cache

Symfony2 - Removed FOS User Bundle manually and now cannot clear cache in production mode


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

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.