FOSUSER捆绑包含多个USer +继承

时间:2014-11-05 00:08:19

标签: symfony doctrine-orm fosuserbundle pugxmultiuserbundle

我使用PUGXMulti USer,它是FOSUserBundle的扩展,用于处理不同类型的用户。 按照STep by Step文档,我创建了我的实体用户,另外两个实体(驱动程序,客户端)扩展了用户

/**@ORM\Entity
 * @ORM\InheritanceType("JOINED")
 * @ORM\DiscriminatorColumn(name="type", type="string")
 * @ORM\DiscriminatorMap({"user_one" = "Dali/FrontBundle/Driver", "user_two" = "Dali/FrontBundle/Client"})
 *
 */
abstract class User extends BaseUser
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id_user;

客户实体以:

开头
* @ORM\Entity
 * @ORM\Table(name="client")
*/
class Client extends User
{
    /**
     * @var string

     */
    private $fnameClient;

我为ClientRegistration创建了一个FormType,

class ClientFormType extends AbstractType {

     public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('fnameClient');
        $builder->add('username');
        $builder->add('email');

问题是当我提交表单时,它给了我错误:

An exception occurred while executing 'SELECT t1.username AS username2, t1.username_canonical AS username_canonical3, .... FROM client t1 WHERE t0.username_canonical = ?' with params ["az"]:

我的评论是他试图where t0.username_canonical而不是t1.username_canonical

的原因。

1 个答案:

答案 0 :(得分:0)

如上所述here

  

FOSUserBundle不适用于实体继承(你应该避免使用它,因为它是Doctrine的性能杀手,因为关系数据库不能存储继承)