Symfony error The class XXX was not found in the chain configured namespaces XXX

By default, the auto_mapping feature looks for entities under the Entity namespace, so given that your entity is not there, Doctrine does not know anything about it.

You need to put your entity under the Entity namespace or configure Doctrine by hand to add your custom entity namespace. This way you lose the auto_mapping feature, so you would need to register every bundle manually:

orm:
    auto_generate_proxy_classes: %kernel.debug%
    entity_managers:
        default:
            mappings:
                MyBundle:
                    type: annotation
                custom_mapping:
                    type: annotation
                    prefix: Client\IntranetBundle\LDAP\
                    dir: "%kernel.root_dir%/src/Client/IntranetBundle/LDAP/"
                    is_bundle: false

As you can see, it’s better to put everything under the Entity namespace in your bundle and let Doctrine do the hard work.

Leave a Comment