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();
Jira issue originally created by user exxbrain:
The next critical case doesn't work, because of Duplicate entry error:
Instead of that i must use the next construction: