-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Description
Jira issue originally created by user exxbrain:
The next critical case doesn't work, because of Duplicate entry error:
$obj = $repository->findOneByUniqueKey($key);
if ($obj != null) {
$em->remove($obj);
}
$obj = new Object();
$obj->setUniqueKey($key);
$em->persist($obj);
$em->flush();
Instead of that i must use the next construction:
$obj = $repository->findOneByUniqueKey($key);
if ($obj != null) {
$em->remove($obj);
$em->flush(); // the possible data inconsistency cause
}
$obj = new Object();
$obj->setUniqueKey($key);
$em->persist($obj);
$em->flush();
Reactions are currently unavailable