Question

My application throws the following exception when I try to insert a new user entity:

An exception occurred while executing 'SELECT t1.username AS username2, t1.username_canonical AS username_canonical3, t1.email AS email4, t1.email_canonical AS email_canonical5, t1.enabled AS enabled6, t1.salt AS salt7, t1.password AS password8, t1.last_login AS last_login9, t1.locked AS locked10, t1.expired AS expired11, t1.expires_at AS expires_at12, t1.confirmation_token AS confirmation_token13, t1.password_requested_at AS password_requested_at14, t1.roles AS roles15, t1.credentials_expired AS credentials_expired16, t1.credentials_expire_at AS credentials_expire_at17, t1.id AS id18, t1.nom AS nom19 FROM etudiant t1 WHERE t0.username_canonical = ?' with params ["dar"]:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.username_canonical' in 'where clause'

User:

<?php

namespace Esprit\UserBundle\Entity;
use Esprit\UserBundle\Entity\User;
use Doctrine\ORM\Mapping as ORM;

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

 /**
 *@ORM\Column(type="string",length=255)
 */

private $nom;

}

config.yml:

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

How can I resolve this issue?

Was it helpful?

Solution 2

so I solved the problem,we should extend from BaseUser

class Student extends BaseUser
{

}

OTHER TIPS

You need to declare the discriminator for your User class with this :

 * @InheritanceType("SINGLE_TABLE")
 * @DiscriminatorColumn(name="discr", type="string")
 * @DiscriminatorMap({"student" = "Student", "employee" = "Employee"})
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top