Reputation: 1
Disable automatic Id field generation in Doctrine
this a part of my entity file:
<?php
namespace MyBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Variables
* @ORM\Table(name="variables")
* @ORM\Entity(repositoryClass="MyBundle\Repository\VariablesRepository")
*/
class Variables
{
/**
* @var int
* @ORM\Column(name="variablesRef", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $variablesRef;
/**
* @var string
* @ORM\Column(name="variablesLibelle", type="string", length=250)
*/
private $variablesLibelle;
when i try to create a schema :
erreur
Property MyBundle\Entity\Employeursecteur::$id does not exist
i want to Disable automatic Id field generation in Doctrine i don't need the id Column please help
Upvotes: 0
Views: 2006
Reputation: 610
If you want a primary key field without a generated value you just have to set the strategy of generation to none:
@ORM\GeneratedValue(strategy="NONE")
Upvotes: 1