Skip to content

Commit 658940d

Browse files
committed
doctrine#11977 only perform batching if/when the AssignedGenerator is in use
The `SequenceGenerator` is potentially used for PostgreSQL table auto-generated fields, but the `SequenceGenerator` is not a **POST**-insert generator. Because the `SequenceGenerator` is used in the middle of `INSERT` operations performed by persisters, we cannot rely on it in batching operations: disabling it, so we get a green test suite on PostgreSQL. This change makes `GH10531Test` pass on PostgreSQL: see doctrine#10531
1 parent ad48737 commit 658940d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Internal/UnitOfWork/InsertBatch.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Doctrine\ORM\Internal\UnitOfWork;
66

77
use Doctrine\ORM\EntityManagerInterface;
8+
use Doctrine\ORM\Id\AssignedGenerator;
89
use Doctrine\ORM\Mapping\ClassMetadata;
910

1011
/**
@@ -55,7 +56,7 @@ public static function batchByEntityType(
5556

5657
if (
5758
$currentClass?->name !== $entityClass->name
58-
|| $entityClass->idGenerator->isPostInsertGenerator()
59+
|| ! $entityClass->idGenerator instanceof AssignedGenerator
5960
) {
6061
$currentClass = $entityClass;
6162
$batches[] = new InsertBatch($entityClass, [$entity]);

0 commit comments

Comments
 (0)