Search code examples
symfonymappingbundlefosuserbundleforum

Error while installing CCDNForumBundle User entity was not found in the chain configured namespaces


I would like to say that is possible that I already have found the solution, too bad it's in french. Below is the link to solution.

http://fr.openclassrooms.com/forum/sujet/mappingexception

Getting error below:

[Doctrine\Common\Persistence\Mapping\MappingException]
The class 'HUPR\UserBundle\Entity\User' was not found in the chain configur ed namespaces CCDNForum\ForumBundle\Entity, FOS\UserBundle\Model

I have this Bundle:

namespace HUPR\UserBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

    class HUPRUserBundle extends Bundle
    {
        public function getParent() {
            return 'FOSUserBundle';
        }
    }

And this is my app/config/config.yml:

Doctrine Configuration

orm:
  default_entity_manager: default
  auto_generate_proxy_classes: "%kernel.debug%"
      resolve_target_entities:
          Symfony\Component\Security\Core\User\UserInterface: HUPR\UserBundle\Entity\User
      entity_managers:
          default:
              mappings:
                  CCDNForumForumBundle:
                      mapping:              true
                      type:                 yml
                      dir:                  "Resources/config/doctrine"
                      alias:                ~
                      prefix:               CCDNForum\ForumBundle\Entity
                      is_bundle:            true

Solution

  • Found the solution, It was needed to map my bundle:

    mappings: 
    FOSUserBundle: ~
    HUPRUserBundle:
        mapping:              true
        type:                 annotation
        #dir:                  "Resources/config/doctrine"
        alias:                ~
        prefix:               HUPR\UserBundle\Entity
        is_bundle:            true
    CCDNForumForumBundle:
        mapping:              true
        type:                 yml
        dir:                  "Resources/config/doctrine"
        alias:                ~
        prefix:               CCDNForum\ForumBundle\Entity
        is_bundle:            true