Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Fatal error: Class 'Application\Sonata\MediaBundle\ApplicationSonataMediaBundle' not found in /var/www/znata.com/app/AppKernel.php on line 47

i followed this doc to install SonataMediaBundle but i got this error:

PHP Fatal error:  Class 'Application\Sonata\MediaBundle\ApplicationSonataMediaBundle' not found in /var/www/znata.com/app/AppKernel.php on line 47

After using the sonata command t generate the app:

php app/console sonata:easy-extends:generate SonataMediaBundle

new directory was generated under:

apps/Application/Sonata/MediaBundle

everything was done but when i registred the generated application in my AppKernel.php i got that error.

public function registerbundles()
{
    return array(
        ...
        new Application\Sonata\MediaBundle\ApplicationSonataMediaBundle(),
        ...
    );
}

Have you any idea how to fix this issue ?

like image 387
skonsoft Avatar asked Sep 05 '12 00:09

skonsoft


1 Answers

  1. inside your composer.json file, have:

    "autoload": {
        "psr-4": {
            "AppBundle\\": "src/AppBundle",
            "Application\\": "src/Application"
        },
    }
    
  2. do a simple:

    composer dump-autoload
    

    to re-generate the autoload files.

like image 50
Pmpr.ir Avatar answered Sep 18 '22 18:09

Pmpr.ir