Skip to content

Commit 010491a

Browse files
Fix saving new problems with statements
Fixes #2646. We used to persist the entity both before and after calling the lifecycle callbacks ourselves, which would introduce weird behavior where Doctrine wanted to insert some rows twice. By not persisting before calling the callbacks ourselves, this issue goes away.
1 parent 90c3ab8 commit 010491a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

webapp/src/Controller/BaseController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Doctrine\ORM\Mapping\MappingException;
2323
use Doctrine\ORM\NonUniqueResultException;
2424
use Doctrine\ORM\NoResultException;
25+
use Doctrine\ORM\UnitOfWork;
2526
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
2627
use Symfony\Component\Form\FormError;
2728
use Symfony\Component\Form\FormInterface;
@@ -561,7 +562,6 @@ protected function processAddFormForExternalIdEntity(
561562
return $response;
562563
}
563564
} else {
564-
$this->em->persist($entity);
565565
$this->saveEntity($entity, null, true);
566566
}
567567
return $this->redirect($urlGenerator());

0 commit comments

Comments
 (0)