Reply
I have a mappgin error
Replies: 6   Views: 2689  Subscribers: 3

Posted by Bobby · 03-03-2013 - 16:02

Hello, I'm a new developper on symfony 2.1
I' learn with your bundle but i have an error :
MappingException: The class 'CCDNUser\UserBundle\Entity\User' was not found in the chain configured namespaces FOS\UserBundle\Entity, CCDNForum\ForumBundle\Entity

I think that the problem is the config file.

Can you help me ?
Thx­

Posted by reece · 03-03-2013 - 21:28

What bundles did you install, can you list them please and make sure you have them setup properly in your AppKernel.php otherwise symfony won't know they exist.­

Posted by Bobby · 04-03-2013 - 06:23

My appkernel :
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
            new JMS\AopBundle\JMSAopBundle(),
            new JMS\DiExtraBundle\JMSDiExtraBundle($this),
            new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
            new CF\BlogBundle\CFBlogBundle(),
            new CCDNUser\UserBundle\CCDNUserUserBundle(),
            new CCDNUser\ProfileBundle\CCDNUserProfileBundle(),
            new FOS\UserBundle\FOSUserBundle(),
            new CCDNForum\ForumBundle\CCDNForumForumBundle(),
            new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
            new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
            new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
            new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
            new CCDNComponent\CommonBundle\CCDNComponentCommonBundle(),
            new CCDNComponent\BBCodeBundle\CCDNComponentBBCodeBundle(),
            new CCDNComponent\CrumbTrailBundle\CCDNComponentCrumbTrailBundle(),
            new CCDNComponent\DashboardBundle\CCDNComponentDashboardBundle(),
            new CCDNForum\AdminBundle\CCDNForumAdminBundle(),
            new EWZ\Bundle\RecaptchaBundle\EWZRecaptchaBundle(),­

Posted by reece · 04-03-2013 - 10:14

Make sure you have done the following in your app/config/config.yml:

­
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: CCDNUser\UserBundle\Entity\User
        entity_managers:
            default:
                mappings:
                    FOSUserBundle: ~
                    CCDNUserUserBundle: ~
                    CCDNUserSecurityBundle:
                        mapping:              true
                        type:                 yml
                        dir:                  "Resources/config/doctrine"
                        alias:                ~
                        prefix:               CCDNUser\SecurityBundle\Entity
                        is_bundle:            true
                    CCDNUserProfileBundle: ~
                    CCDNComponentCommonBundle: ~
                    CCDNComponentCrumbTrailBundle: ~
                    CCDNComponentBBCodeBundle: ~
                    CCDNComponentDashboardBundle: ~
                    CCDNComponentAttachmentBundle:
                        mapping:              true
                        type:                 yml
                        dir:                  "Resources/config/doctrine"
                        alias:                ~
                        prefix:               CCDNComponent\AttachmentBundle\Entity
                        is_bundle:            true
                    CCDNForumAdminBundle: ~
                    CCDNForumForumBundle:
                        mapping:              true
                        type:                 yml
                        dir:                  "Resources/config/doctrine"
                        alias:                ~
                        prefix:               CCDNForum\ForumBundle\Entity
                        is_bundle:            true­
I think thats what you maybe missing. Did you follow all the other steps in the installation process?­

Posted by reece · 04-03-2013 - 10:21

You might also want to look at the config for fos user bundle.

Make sure you have something like this, the most important part of which is the user entity class.

­
cc_user:             
    db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
    user_class: CCDNUser\UserBundle\Entity\User
    firewall_name: main
    model_manager_name:   ~ 
    use_listener:         true 
    use_username_form_type:  true 
    from_email:           
        address:              [email protected] 
        sender_name:          root 
#    profile:              
#        form:                 
#            type:                 cc_user_profile 
#            handler:              cc_user.profile.form.handler.default 
#            name:                 cc_user_profile_form 
#            validation_groups:    
#
#                # Defaults:
#                - Profile
#                - Default
#    change_password:      
#        form:                 
#            type:                 cc_user_change_password 
#            handler:              cc_user.change_password.form.handler.default 
#            name:                 cc_user_change_password_form 
#            validation_groups:    
#
#                # Defaults:
#                - ChangePassword
#                - Default
    registration:         
        confirmation:         
            enabled:              false 
            template:             FOSUserBundle:Registration:email.txt.twig 
            from_email:           
                address:              [email protected]
                sender_name:          CodeConsortium
        form:                 
            type:                 ccdn_user_registration 
            handler:              cc_user.registration.form.handler.default 
            name:                 cc_user_registration_form 
            validation_groups:    

                # Defaults:
                - Registration
                - Default
#    resetting:            
#        token_ttl:            86400 
#        email:                
#            template:             FOSUserBundle:Resetting:email.txt.twig 
#            from_email:           
#                address:              ~ # Required
#                sender_name:          ~ # Required
#        form:                 
#            type:                 cc_user_resetting 
#            handler:              cc_user.resetting.form.handler.default 
#            name:                 cc_user_resetting_form 
#            validation_groups:    
#
#                # Defaults:
#                - ResetPassword
#                - Default
#    service:              
#        mailer:               cc_user.mailer.default 
#        email_canonicalizer:  cc_user.util.canonicalizer.default 
#        token_generator:      cc_user.util.token_generator.default 
#        username_canonicalizer:  cc_user.util.canonicalizer.default 
#        user_manager:         cc_user.user_manager.default 
    template:             
        engine:               twig 
#    group:                
#        group_class:          ~ # Required
#        group_manager:        cc_user.group_manager.default 
#        form:                 
#            type:                 cc_user_group 
#            handler:              cc_user.group.form.handler.default 
#            name:                 cc_user_group_form 
#            validation_groups:    
#
#                # Defaults:
#                - Registration
#                - Default­

Posted by Bobby · 04-03-2013 - 12:11

Thx, my config file was incomplete.
I will continue my learning.­

Posted by layemira · 15-09-2016 - 15:59

echo $s=5;­