Home » Php » PHP Symfony Attempted to load class "SonataIntlBundle" from namespace "Sonata\IntlBundle"

PHP Symfony Attempted to load class "SonataIntlBundle" from namespace "Sonata\IntlBundle"

Posted by: admin February 25, 2020 Leave a comment

Questions:

I am new to Symfony and PHP in general, I just want to set up a project from GitHub and instruction says that I have to run composer update. So after this command an error logs:

 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:                                                                                                                                                        

  Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SonataIntlBundle" from namespace "Sonata\IntlBundle".                                                                   
  Did you forget a "use" statement for another namespace? in /Users/xxx/Documents/project/app/AppKernel.php:28                                                                                                                 
  Stack trace:                                                                                                                                                                                                                     
  #0 /Users/xxx/Documents/project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(427): AppKernel->registerBundles()                                                                                        
  #1 /Users/xxx/Documents/project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(128): Symfony\Component\HttpKernel\Kernel->initializeBundles()                                                            
  #2 /Users/xxx/Documents/project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(62): Symfony\Component\HttpKernel\Kernel->boot()                                                           
  #3 /Users/xxx/Documents/project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(117): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Obj  
  ect(Symfony\Component\Console\Output\ConsoleOutput))                                                                                                                                                                             
  #4 /U in /Users/xxx/Documents/project/app/AppKernel.php on line 28                                                                                                                                                           

  PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SonataIntlBundle" from namespace "Sonata\IntlBundle".                                                              
  Did you forget a "use" statement for another namespace? in /Users/xxx/Documents/project/app/AppKernel.php:28                                                                                                                 
  Stack trace:                                                                                                                                                                                                                     
  #0 /Users/xxx/Documents/project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(427): AppKernel->registerBundles()                                                                                        
  #1 /Users/xxx/Documents/project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(128): Symfony\Component\HttpKernel\Kernel->initializeBundles()                                                            
  #2 /Users/xxx/Documents/project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(62): Symfony\Component\HttpKernel\Kernel->boot()                                                           
  #3 /Users/xxx/Documents/project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(117): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Obj  
  ect(Symfony\Component\Console\Output\ConsoleOutput))                                                                                                                                                                             
  #4 /U in /Users/xxx/Documents/project/app/AppKernel.php on line 28       

Can anyone help me with this one? I’m kinda lost.

How to&Answers:

As @Cid mentioned, I re-cloned the repo and this time used composer install instead of update and it works just fine!