Reply
Ccdn_user_security (mappingexception)
Replies: 15   Views: 3507  Subscribers: 5

Posted by zorg · 27-04-2013 - 08:43

Edited by zorg · 27-04-2013 - 11:11
i just update Symfony to 2.2.1, i have FOsUserBundle 2.0, and ccdn_user_security master.

i have this error :

MappingException: The class 'app\UserBundle\Entity\User' was not found in the chain configured namespaces CCDNUser\SecurityBundle\Entity

can you help?

thank

i just change this :
        auto_generate_proxy_classes: "%kernel.debug%"
        auto_mapping: true
#        default_entity_manager: default
#        auto_generate_proxy_classes: "%kernel.debug%"
#        entity_managers:
#            default:
#                mappings:
#                    CCDNUserSecurityBundle:
#                        mapping:              true
#                        type:                 yml
#                        dir:                  "Resources/config/doctrine"
#                        alias:                ~
#                        prefix:               CCDNUser\SecurityBundle\Entity
#                        is_bundle:            true

in app/config/config.yml and now see to work well.­

Posted by reece · 27-04-2013 - 15:11

Firstly, make sure your user bundle is setup correctly and works on its own without the SecurityBundle to ensure that its setup correctly.

Then make sure you are resolving the target entity interface listener (resolve_target_entities) using a similar configuration to 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: FOSUser\UserBundle\Entity\User
        entity_managers:
            default:
                mappings:
                    FOSUserBundle: ~
                    CCDNUserSecurityBundle:
                        mapping:              true
                        type:                 yml
                        dir:                  "Resources/config/doctrine"
                        alias:                ~
                        prefix:               CCDNUser\SecurityBundle\Entity
                        is_bundle:            true­
Make sure you have gone through all the setup steps.­

Posted by zorg · 27-04-2013 - 17:17

first thank for the anscew.

it look lake working perfect with out : 

# default_entity_manager: default
# auto_generate_proxy_classes: "%kernel.debug%"
# entity_managers:
# default:
# mappings:
# CCDNUserSecurityBundle:
# mapping: true
# type: yml
# dir: "Resources/config/doctrine"
# alias: ~
# prefix: CCDNUser\SecurityBundle\Entity
# is_bundle: true

then i try the new code that you give, and i have the same error as before : 

MappingException: The class 'AppWeb\UserBundle\Entity\User' was not found in the chain configured namespaces FOS\UserBundle\Entity, CCDNUser\SecurityBundle\Entity­

Posted by reece · 27-04-2013 - 19:00

1) Are you sure all of the bundles listed are in the vendors directory and downloaded correctly?

2) Have you added all the bundles to the AppKernel? The error seems to me like you have not added the bundles to the AppKernel, or perhaps you missed one.

3) Did you check that your UserBundle properly extends the FOSUserBundle?

I believe the issue is more likely to be with FOSUserBundle not being installed correctly. 

Did you try my suggestion to disable the SecurityBundle to ensure your custom UserBundle is working correctly first?­

Posted by zorg · 27-04-2013 - 19:40

i will try all one by one as you ask and come back.
thank­

Posted by zorg · 27-04-2013 - 19:53

in composer.json :
       "symfony/symfony"                       : "2.2.*",
        "doctrine/orm"                          : "~2.2,>=2.2.3",
        "doctrine/doctrine-bundle"              : "1.2.*",
        "twig/extensions"                       : "1.0.*",
        "symfony/assetic-bundle"                : "2.1.*",
        "symfony/swiftmailer-bundle"            : "2.2.*",
        "symfony/monolog-bundle"                : "2.2.*",
        "sensio/distribution-bundle"            : "2.2.*",
        "sensio/framework-extra-bundle"         : "[email protected]",
        "sensio/generator-bundle"               : "2.2.*",
        "jms/security-extra-bundle"             : "1.4.*",
        "jms/di-extra-bundle"                   : "1.3.*",
        "symfony/console"                       : "[email protected]",

        "codeconsortium/ccdn-user-security-bundle"      : "dev-master",
        "friendsofsymfony/user-bundle"                  : "2.0.x-dev",
        "jms/translation-bundle"                        : "[email protected]",
        "jms/i18n-routing-bundle"                       : "[email protected]",
        "apy/breadcrumbtrail-bundle"                    : "dev-master",
        "knplabs/knp-menu"                              : "[email protected]",
        "knplabs/knp-menu-bundle"                       : "[email protected]",
        "genemu/form-bundle"                            : "dev-master",
        "coresphere/console-bundle"                     : "dev-master",

        "sonata-project/admin-bundle"               : "dev-master",
        "sonata-project/doctrine-orm-admin-bundle"  : "dev-master",
        "sonata-project/intl-bundle"                : "dev-master",
        "sonata-project/cache-bundle"               : "dev-master",
        "sonata-project/block-bundle"               : "dev-master",
        "sonata-project/media-bundle"               : "dev-master",
        "sonata-project/notification-bundle"        : "2.2.*dev"
commande log :
> D:\Programmation\Web\server\xampp\php\php.exe D:\Programmation\Web\root_www\appWebTest\composer.phar update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Generating autoload files
Clearing the cache for the dev environment with debug true
Installing assets using the hard copy option
Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework
Installing assets for Stfalcon\Bundle\TinymceBundle into web/bundles/stfalcontinymce
Installing assets for Genemu\Bundle\FormBundle into web/bundles/genemuform
Installing assets for appWeb\PublicBundle into web/bundles/public
Installing assets for appWeb\UserBundle into web/bundles/user
Installing assets for appWeb\MemberBundle into web/bundles/member
Installing assets for appWeb\AdminBundle into web/bundles/admin
Installing assets for appWeb\SolutionBundle into web/bundles/solution
Installing assets for appWeb\ServiceBundle into web/bundles/service
Installing assets for appWeb\NeoNewsBundle into web/bundles/neonews
Installing assets for appWeb\NeoMenuBundle into web/bundles/neomenu
Installing assets for Sensio\Bundle\DistributionBundle into web/bundles/sensiodistribution
Installing assets for CoreSphere\ConsoleBundle into web/bundles/coresphereconsole

Process finished with exit code 0 at 22:48:49.
Execution time: 94 130 ms.

all is there no, i mean that if not composer will sai !?

App/appkernel.php:
            new JMS\I18nRoutingBundle\JMSI18nRoutingBundle(),
            new FOS\UserBundle\FOSUserBundle(),
            new CCDNUser\SecurityBundle\CCDNUserSecurityBundle(),
            new APY\BreadcrumbTrailBundle\APYBreadcrumbTrailBundle(),
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
            new Stfalcon\Bundle\TinymceBundle\StfalconTinymceBundle(),
            new Genemu\Bundle\FormBundle\GenemuFormBundle(),

so i will delet all FOSuser and reinstall all !! and see­

Posted by reece · 27-04-2013 - 20:13

Make sure you add the resolve_target_entities to your doctrine config:

­
resolve_target_entities:
            Symfony\Component\Security\Core\User\UserInterface: FOSUser\UserBundle\Entity\User­
Or perhaps your own user bundle, i think it was app\UserBundle\Entity\User. ­
resolve_target_entities:
            Symfony\Component\Security\Core\User\UserInterface: App\UserBundle\Entity\User­
One thing, why App? You should have your custom user bundle in src/ or vendors/ and with a namespace for your company/project. i.e; Acme\UserBundle, not App\UserBundle, with the namespace Acme, it should be in one of 2 places: 1) app/src/Acme/UserBundle (namespace would be Acme\UserBundle() ) or 2) vendor/acme/acme-user-bundle/Acme/UserBundle (namespace still Acme\UserBundle) I really think this is not an issue with SecurityBundle, i feel this is FOSUserBundle not correctly setup.­

Posted by zorg · 28-04-2013 - 20:42

so reset all my app, i deed start form 0 and change all the root name, it semce that your idear was good!!, i mean that i deed not finish yet, lot of bug simce to desipire (go).

i will reinstal FOSUser and ccdn_user during the week i will come back for resultat !!

thank­

Posted by zorg · 28-04-2013 - 22:25

so back, and :
MappingException: The class 'Control\UserBundle\Entity\User' was not found in the chain configured namespaces FOS\UserBundle\Entity, CCDNUser\SecurityBundle\Entity

still there !!!

FOSUserbundle work perfect alone!!

Ver. Symfony 2.2.1, FOSUser 1.3, ccdnUserSecurity master­

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.­

Posted by zorg · 29-04-2013 - 10:56

Sorry to make all confused, i decide to re-install all form the start, just to make sur of my configuration, and this take same bug's that i have with same bundle.

Now it is only one root : Control/UserBundle for the child user bundle.

i confirm that  FOSUserBundle works fine alone on this root, and the child user bundle (Control/UserBundle) work also.

for the rest i will try later in the day.

thank very must for your "patience".­

Posted by zorg · 30-04-2013 - 08:40

so finaly i think as you said i have probleme with all my projet, i will get in orfer first and come back if i styll have this probleme.

thank.­

Posted by josecelano · 21-02-2014 - 17:54

I had the same problem and in my case I fixed it changing some settings:

­
resolve_target_entities:
            Symfony\Component\Security\Core\User\UserInterface: Acme\UserBundle\Entity\User        
        default_entity_manager: default
        auto_generate_proxy_classes: "%kernel.debug%"
        entity_managers:
            default:
                mappings: 
                    FOSUserBundle: ~
                    AcmeUserBundle:
                        mapping:              true
                        type:                 annotation
                        #dir:                  "Resources/config/doctrine"
                        alias:                ~
                        prefix:               Acme\UserBundle\Entity
                        is_bundle:            true
                    CCDNUserSecurityBundle:
                        mapping:              true
                        type:                 yml
                        dir:                  "Resources/config/doctrine"
                        alias:                ~
                        prefix:               CCDNUser\SecurityBundle\Entity
                        is_bundle:            true­
Because I am using annotations in my User entity instead of xml or yml files.­

Posted by booosss · 12-06-2015 - 07:29

kjmlk­

Posted by kochuev · 22-07-2015 - 22:34

test test test test­

Posted by kochuev · 22-07-2015 - 22:34

test test test test­