I have a class with field ID autoincrement
class Prueba{
/**
* @var integer $id
*
* @ORM\Column(name="`id`", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
but when I try this:
public function __construct()
{
$this->entorno = new Entorno('MSU',$this->id);
}
this->id is not initialize to 1 and is NULL
I want this:
if is the first new Prueba() or doctrine prueba is empty
$this->id = 1
else
$this->id=get the last ID from table Prueba in doctrine.
How I can do?
Sorry to all, I forgot to include this in my class Entorno: * @ORM\JoinColumn(name="prueba_id", referencedColumnName="id")