0
votes

I created a bundle named UserBundle and when I needed to remove it I did this exacly :

  1. Unregister the Bundle in the AppKernel
  2. Remove Bundle Configuration 2.1 Remove Bundle Routing 2.2 Remove Bundle Configuration
  3. Remove the Bundle from the Filesystem 3.1 Remove Bundle Assets
  4. Remove Integration in other Bundles

but when I try to exec soms command this is what I Get :

[Symfony\Component\Config\Exception\FileLoaderLoadException] Bundle "UserBundle" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your AppKernel.php file? in @UserBundle/Resources/config/s ervices.yml (which is being imported from "C:\xampp\htdocs\MT\app/config\config.yml"). Make sure the "UserBundle/Resources/config/services.yml" bundle is correctly registered an d loaded in the application kernel class. If the bundle is registered, make sure the bundle path "@UserBundle/Resources/config/services.yml" is not empty.

[InvalidArgumentException] Bundle "UserBundle" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your AppKernel.php file?

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception

[RuntimeException] An error occurred when executing the ""cache:clear --no-warmup"" command:

[Symfony\Component\Config\Exception\FileLoaderLoadException] Bundle "UserBundle" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your AppKernel.php file? in @UserBundle/Resources/config/services.yml (which is being imported from "C:\xampp\htdocs\MT\app/config\config.yml"). Make sure the "UserBundle/Resources/config/services.yml" bundle is correctly registered and loaded in the application kernel class. If the bundle is registered, make sure the bundle path "@UserBundle/Resources/config/services.yml" is not empty.

When I Refresh the server 'http://127.0.0.1/mt/web/' I get :

Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Bundle "UserBundle" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your AppKernel.php file?' in C:\xampp\htdocs\MT\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php:198 Stack trace: #0 C:\xampp\htdocs\MT\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php(232): Symfony\Component\HttpKernel\Kernel->getBundle('UserBundle', false) #1 C:\xampp\htdocs\MT\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Config\FileLocator.php(51): Symfony\Component\HttpKernel\Kernel->locateResource('@UserBundle/Res...', NULL, false) #2 C:\xampp\htdocs\MT\vendor\symfony\symfony\src\Symfony\Component\Config\Loader\FileLoader.php(147): Symfony\Component\HttpKernel\Config\FileLocator->locate('@UserBundle/Res...', 'C:\xampp\htdocs...', false) #3 C:\xampp\htdocs\MT\vendor\symfony\symfony\src\Symfony\Component\Config\Loader\FileLoader.php(101): Symfony\Component\Config\Loader\FileLoader-> in C:\xampp\htdocs\MT\vendor\symfony\symfony\src\Symfony\Component\Config\Loader\FileLoader.php on line 179

3
Is the bundle referenced in the composer.json file? You probably need to remove that too.Alvin Bunk
Did you clean the cache?. Try rm -rf app/cache/*ste
it's not referenced in the composer.jsonReda Hazmi A-nwo
i couldn't clear the cache cus when i try to execute any command i get that lovely error msgReda Hazmi A-nwo
As @ste suggested, use rm -r app/cache/* to clear the cache from the command line. Think of this as a superuser cache clear. There are times when you can't run the console command due to that changes that you made. And this is one of them.Cerad

3 Answers

1
votes

In C:\xampp\htdocs\MT\app\config\config.yml you may have something like:

imports:
    - { resource: @UserBundle/Resources/config/services.yml }

and possibly a configuration section related to the user bundle, i.e.

user_bundle:
    ...

You have to manually remove both to make everything working again.

0
votes
  1. Can you check if you use this bundle in app/config/service.yml

  2. If it's not working, try to search with your IDE (integrated development environment) your bundle inside your project. If you find some results, just remove them.

  3. Clear the cache

0
votes

Try to clear cache manually by removing those folders : "var\cache\dev" and "var\cache\prod" for Symfony 3.x or "app\cache\dev" and "app\cache\prod" for Symfony 2.x .