im using Doctrine on Symfony2 and im trying to insert some values on my table, but if I try to insert a duplicate key I got an error from the system:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'test-1-2-2016-10-11-13' for key 'Unique'
That's my code:
$insert = new Alerts();
$insert->setAlKeyword($alert_keyword);
$insert->setAlLocation($alert_location);
$insert->setAlDevice($alert_device);
$insert->setAlSource($alert_source);
$insert->setAlSubDate(new \DateTime($alert_date);
$insert->setAlSubHour($alert_time);
$insert->setAlTotal(+1);
$em = $this->getDoctrine()->getManager("my_em");
$em->persist($insert);
$em->flush();
The problem is about the DUPLICATE KEY UPDATE statement: how can I use that statement in doctrine?
Thanks a lot