File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -9,12 +9,12 @@ Make sure to use the former when writing a type declaration or an `instanceof` c
9
9
To keep PHP mapping attributes consistent, order of arguments passed to above attributes has been changed
10
10
so ` $targetEntity ` is a first argument now. This change affects only non-named arguments usage.
11
11
12
- ## BC BREAK: AUTO keyword for identity generation defaults to IDENTITY for PostgreSQL now
12
+ ## BC BREAK: AUTO keyword for identity generation defaults to IDENTITY for PostgreSQL when using ` doctrine/dbal ` 4
13
13
14
- When using the AUTO strategy to let Doctrine determine the identity generation mecehanism for
15
- an entity, PostgreSQL now uses IDENTITY instead of SEQUENCE. When upgrading from ORM 2.x
16
- and preference is on keeping the SEQUENCE based identity generation, then configure the ORM
17
- this way:
14
+ When using the ` AUTO ` strategy to let Doctrine determine the identity generation mechanism for
15
+ an entity, and when using ` doctrine/dbal ` 4, PostgreSQL now uses ` IDENTITY `
16
+ instead of ` SEQUENCE ` . When upgrading from ORM 2.x and preference is on keeping
17
+ the ` SEQUENCE ` based identity generation, then configure the ORM this way:
18
18
19
19
``` php
20
20
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
Original file line number Diff line number Diff line change 34
34
use function in_array ;
35
35
use function is_a ;
36
36
use function is_subclass_of ;
37
+ use function method_exists ;
37
38
use function str_contains ;
38
39
use function strlen ;
39
40
use function strtolower ;
@@ -616,6 +617,13 @@ private function determineIdGeneratorStrategy(AbstractPlatform $platform): int
616
617
}
617
618
}
618
619
620
+ $ nonIdentityDefaultStrategy = self ::NON_IDENTITY_DEFAULT_STRATEGY ;
621
+
622
+ // DBAL 3
623
+ if (method_exists ($ platform , 'getIdentitySequenceName ' )) {
624
+ $ nonIdentityDefaultStrategy [Platforms \PostgreSQLPlatform::class] = ClassMetadata::GENERATOR_TYPE_SEQUENCE ;
625
+ }
626
+
619
627
foreach (self ::NON_IDENTITY_DEFAULT_STRATEGY as $ platformFamily => $ strategy ) {
620
628
if (is_a ($ platform , $ platformFamily )) {
621
629
return $ strategy ;
You can’t perform that action at this time.
0 commit comments