Search code examples
phpsymfonycomposer-phpbundlesonata-admin

error while extending the bundle ClassNotFoundException


I just created a new 2.8 Symfony project then added SonataAdminBundle when I tried to add SonataMediaundle as you can see in the screenshot after completing step 2.5 in the documentation I get this error that I just couldn't explain.

image description here

image description here

(I'm a new user so I can't add pictures yet so you'll only see the link)


Solution

  • first of all, Cerad, the problem solved thanks to you, by changing the autoload in my composer.json file from this:

    ...
    "autoload": {
        "psr-4": {
            "AppBundle\\": "src/AppBundle"
        },
    

    To this:

    ...
    "autoload": {
        "psr-4": {
            "": "src/"
        },
    

    then run command:

    composer dumpautoload

    and Voilà everything come back to work.