Search code examples
symfonyentitysymfony-sonata

Unknown Entity namespace alias 'PirastruFormBuilderBundle'


It has been now 2 days that i'm looking for a solution to this error but in vain :

Unknown Entity namespace alias 'PirastruFormBuilderBundle'

in fact i installed the sonata form builder with sonata page bundle using the composer but i don't know why i'm getting this error.

i don't know which part of codes should i copie here so please don't hesitate to ask me for it

sonata_form_builder:
    resource: '@PirastruFormBuilderBundle/Controller/FormBuilderController.php'
    type:  annotation

Thanks !!

EDIT

when i run this : php app/console config:dump-reference

PirastruFormBuilderBundle | pirastru_form_builder |

and when i run this : php app/console doctrine:mapping:info i got

[Exception] You do not have any mapped Doctrine ORM entities according to the current configuration. If you have entities or mapping files you should check your mapping configuration for errors.

well i managed to solve the problem ! i had just to add a getManager in my FormBuilderBlockService


Solution

  • This problem can be caused by some (mis)configurations :

    Bundle

    app/console config:dump-reference
    

    This command let you know if the Bundle is referenced.

    Mapping

    app/console doctrine:mapping:info
    

    This command let you know if the Bundle is mapped.

    It's typically a mapping issue :

    Unknown Entity namespace alias '***Bundle'

    The better solution is to add auto_mapping to true in config.yml, like this :

    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        auto_mapping: true
    

    But it can be solved by others way, you can have a look to : Symfony : What is the meaning of auto_mapping and auto_generate_proxy_classes

    Best regards,