I keep getting the error in the title when I want to login using the FOSUserBundle on Symfony. The problem is, I already have an "id" for my User table from my database so I don't want to create an "id" field like they ask on the FOSUserBundle guide. I don't understand why it would give me this error when there is no more "id" field in my code.
Is this "id" field mandatory?
Here is the code of my User class (here called "Utilisateurs")`use Doctrine\ORM\Mapping as ORM; use FOS\UserBundle\Model\User as BaseUser;
/**
* Utilisateurs
*
* @ORM\Table(name="utilisateurs", indexes={@ORM\Index(name="FK_UTILISATEURS_id_sexe", columns={"id_sexe"}), @ORM\Index(name="FK_UTILISATEURS_id_niveau", columns={"id_niveau"})})
* @ORM\Entity
*/
class Utilisateurs extends BaseUser
{
public function __construct()
{
parent::__construct();
}
/**
* @var string
*
* @ORM\Column(name="nom", type="string", length=25, nullable=true)
*/
private $nom;
/**
* @var string
*
* @ORM\Column(name="prenom", type="string", length=25, nullable=true)
*/
private $prenom;
/**
* @var \DateTime
*
* @ORM\Column(name="date_naissance", type="date", nullable=true)
*/
private $dateNaissance;
/**
* @var string
*
* @ORM\Column(name="url_photo", type="string", length=100, nullable=true)
*/
private $urlPhoto;
/**
* @var integer
*
* @ORM\Column(name="id_utilisateur", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $idUtilisateur;
/**
* @var \Site\UserBundle\Entity\Sexes
*
* @ORM\ManyToOne(targetEntity="Site\UserBundle\Entity\Sexes")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="id_sexe", referencedColumnName="id_sexe")
* })
*/
private $idSexe;
/**
* @var \Site\UserBundle\Entity\Niveaux
*
* @ORM\ManyToOne(targetEntity="Site\UserBundle\Entity\Niveaux")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="id_niveau", referencedColumnName="id_niveau")
* })
*/
private $idNiveau;`
As you can see I already have an "id_utilisateur" field which is the id of this entity. And here is the code of the entity information in XML: The XML Code
Also here is a screenshot of the error I get when I try to log in: The Error