Doctrine does not display fields from the FOSUserBundle user class

I'm using Symfony 2.1 RC1and FOSUserbundleon a Windows server with PHP 5.3.13.

I followed the instructions here , but Doctrine does not create fields in the database for properties inherited from the base class of the FOS user (only fields from my class).

Attempting to log in using the FOS login form gives an error:

Unrecognized field: usernameCanonical

I have the following Doctrine configuration:

# Doctrine Configuration
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

And the configuration of the FOSUserBundle looks like this:

fos_user:
    db_driver: orm
    firewall_name: main
    user_class: SP\PickList\UserBundle\Entity\User

My custom object:   

namespace SP\PickList\UserBundle\Entity;

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

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


    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }
}

Thanks for any help,

James scam

+5
source share
3 answers

, ORM ODM, Doctrine ORM , FOS\UserBundle\Entity\User, use

use FOS\UserBundle\Entity\User as BaseUser;
+17

- . , auto_mapping ORM config.yml, 'FOSUserBundle: ~' .

+5

You must also specify the user class to be used in app / config / config.yml

# FOS
fos-user: 
    db_driver: orm
    firewall_name: main #optional
    user_class: FOS\UserBundle\Entity\User
+1
source

All Articles