Ccdn_user_security (mappingexception)
Replies: 15   Views: 3641  Subscribers: 5

Posted by reece · 28-04-2013 - 23:00

Sorry but im confused, you keep changing where your user bundle is.

Firstly, you state FOSUserBundle works fine, but does your child bundle work? 

Because you stated 3 different child bundle namespaces so far:
app\UserBundle\Entity\User
AppWeb\UserBundle\Entity\User
Control\UserBundle\Entity\User

Why do you keep changing this?

Its making it near impossible to work out what the problem is.

So lets clarify here:
1) You have FOSUserBundle, which you say works fine on its own. Ok.
2) You have a child bundle of FOS it would seem (whose namespace keeps changing which is unhelpful), does this work also? i.e if you have FOSUserBundle and your child user bundle, do they both work? with security bundle disabled.

As im not sure what your doing, lets clarify another thing, the configuration below is for Doctrine and not the security bundle:

­
doctrine:
    dbal:
        driver:   "%database_driver%"
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8
    orm:
        default_entity_manager: default
        auto_generate_proxy_classes: "%kernel.debug%"
        #auto_mapping: true
        resolve_target_entities:
            Symfony\Component\Security\Core\User\UserInterface: ControlUser\UserBundle\Entity\User
        entity_managers:
            default:
                mappings:­
So, make sure you have your UserBundle from Control working on its own, it should have a configuration for Doctrine also, like this: ­
doctrine:
    dbal:
        driver:   "%database_driver%"
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8
    orm:
        default_entity_manager: default
        auto_generate_proxy_classes: "%kernel.debug%"
        #auto_mapping: true
        resolve_target_entities:
            Symfony\Component\Security\Core\User\UserInterface: ControlUser\UserBundle\Entity\User
        entity_managers:
            default:
                mappings:
                    FOSUserBundle: ~
                    ControlUserUserBundle:
                        mapping:              true
                        type:                 yml
                        dir:                  "Resources/config/doctrine"
                        alias:                ~
                        prefix:               ControlUser\UserBundle\Entity
                        is_bundle:            true­
That should work without the SecurityBundle enabled in AppKernel. Next step, is follow SecurityBundle install instructions and add the SecurityBundle configuration: ­
doctrine:
    dbal:
        driver:   "%database_driver%"
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8
    orm:
        default_entity_manager: default
        auto_generate_proxy_classes: "%kernel.debug%"
        #auto_mapping: true
        resolve_target_entities:
            Symfony\Component\Security\Core\User\UserInterface: ControlUser\UserBundle\Entity\User
        entity_managers:
            default:
                mappings:
                    FOSUserBundle: ~
                    ControlUserUserBundle:
                        mapping:              true
                        type:                 yml
                        dir:                  "Resources/config/doctrine"
                        alias:                ~
                        prefix:               ControlUser\UserBundle\Entity
                        is_bundle:            true
                    CCDNUserSecurityBundle:
                        mapping:              true
                        type:                 yml
                        dir:                  "Resources/config/doctrine"
                        alias:                ~
                        prefix:               CCDNUser\SecurityBundle\Entity
                        is_bundle:            true­
Please do not rush into this, your doing something wrong and its difficult to diagnose the problem because your not always addressing each of my questions. Please take your time, and do everything step by step and also please address my questions, otherwise i am unable to help you. It would also help if you could please paste your AppKernel here.­