Symfony 5 Bundle namespace autoload failed

I create a bundle like this

<?php

namespace CDCBasementBundleUtilBundle;

use SymfonyComponentHttpKernelBundleBundle;

class CDCUtilBundle extends Bundle {}

and add composer.json file on root directory of my bundle folder, and put this in autoload

"psr-4": { "CDCBasementBundleUtilBundle": "src/" },

the main class located in /src folder.

After I run composer dump-autoload command, but I get this error:
Attempted to load class “CDCUtilBundle” from namespace “CDCBasementBundleUtilBundle”.
Did you forget a “use” statement for another namespace?

If I understood correctly after command run, the new namespace should be added in autoload_psr4.php and autoload_static.php (vendor/composer/) , also in main composer.json too like other bundles https://prnt.sc/r9rwss.

What did I do wrong ? Maybe I forgot add somewhere configs or I need to run other commands too ?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *