0
votes

I have problem:

MappingException: The class 'Acme\UserBundle\Entity\User' was not found in the chain configured namespaces FOS\UserBundle\Entity, FOS\UserBundle\Model

My file Acme\UserBundle\Entity\User

<?php
    // src/Acme/UserBundle/Entity/User.php

    namespace Acme\UserBundle\Entity;

    use FOS\UserBundle\Model\User as BaseUser;
    use Doctrine\ORM\Mapping as ORM;

    /**
     * @ORM\Entity
     * @ORM\Table(name="fos_user")
     */
    class User extends BaseUser
    {
        /**
         * @ORM\Id
         * @ORM\Column(type="integer")
         * @ORM\GeneratedValue(strategy="AUTO")
         */
        protected $id;

        public function __construct()
        {
            parent::__construct();
            // your own logic
        }
}
2
Do you have respect this part of configuration ? github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/…Baptiste Donaux
If you follow the documentation correctly it works. I've tried it multiple times, with different version of Symfony.iswinky

2 Answers

1
votes

Probably you are missing configuration file.

app/config/config.yml

fos_user:
    db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
    firewall_name: main
    user_class: Acme\UserBundle\Entity\User

Cheers!

0
votes

Also make sure your doctrine configuration in your config.yml looks similar 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:
    auto_generate_proxy_classes: "%kernel.debug%"
    auto_mapping: true

(Notable the auto_mapping: true and the auto_generate_proxy_classes... )