File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
src/Symfony/Bridge/Doctrine/IdGenerator Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 12
12
namespace Symfony \Bridge \Doctrine \IdGenerator ;
13
13
14
14
use Doctrine \ORM \EntityManager ;
15
+ use Doctrine \ORM \EntityManagerInterface ;
15
16
use Doctrine \ORM \Id \AbstractIdGenerator ;
16
17
use Symfony \Component \Uid \Factory \UlidFactory ;
17
18
use Symfony \Component \Uid \Ulid ;
@@ -25,7 +26,15 @@ public function __construct(UlidFactory $factory = null)
25
26
$ this ->factory = $ factory ;
26
27
}
27
28
29
+ /**
30
+ * doctrine/orm < 2.11 BC layer
31
+ */
28
32
public function generate (EntityManager $ em , $ entity ): Ulid
33
+ {
34
+ return $ this ->generateId ($ em , $ entity );
35
+ }
36
+
37
+ public function generateId (EntityManagerInterface $ em , $ entity ): Ulid
29
38
{
30
39
if ($ this ->factory ) {
31
40
return $ this ->factory ->create ();
Original file line number Diff line number Diff line change 12
12
namespace Symfony \Bridge \Doctrine \IdGenerator ;
13
13
14
14
use Doctrine \ORM \EntityManager ;
15
+ use Doctrine \ORM \EntityManagerInterface ;
15
16
use Doctrine \ORM \Id \AbstractIdGenerator ;
16
17
use Symfony \Component \Uid \Factory \UuidFactory ;
17
18
use Symfony \Component \Uid \Uuid ;
@@ -27,7 +28,15 @@ public function __construct(UuidFactory $factory = null)
27
28
$ this ->protoFactory = $ this ->factory = $ factory ?? new UuidFactory ();
28
29
}
29
30
31
+ /**
32
+ * doctrine/orm < 2.11 BC layer
33
+ */
30
34
public function generate (EntityManager $ em , $ entity ): Uuid
35
+ {
36
+ return $ this ->generateId ($ em , $ entity );
37
+ }
38
+
39
+ public function generateId (EntityManagerInterface $ em , $ entity ): Uuid
31
40
{
32
41
if (null !== $ this ->entityGetter ) {
33
42
if (\is_callable ([$ entity , $ this ->entityGetter ])) {
You can’t perform that action at this time.
0 commit comments