File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony \Bridge \Doctrine \DependencyInjection \CompilerPass ;
13
+
14
+ use Symfony \Bridge \Doctrine \Types \UlidType ;
15
+ use Symfony \Bridge \Doctrine \Types \UuidType ;
16
+ use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
17
+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
18
+ use Symfony \Component \Uid \AbstractUid ;
19
+
20
+ /
D25D
**
21
+ * Registers additional validators.
22
+ *
23
+ * @author Benjamin Eberlei <kontakt@beberlei.de>
24
+ */
25
+ class RegisterUidTypePass implements CompilerPassInterface
26
+ {
27
+ /**
28
+ * {@inheritdoc}
29
+ */
30
+ public function process (ContainerBuilder $ container )
31
+ {
32
+ if (!class_exists (AbstractUid::class)) {
33
+ return ;
34
+ }
35
+
36
+ $ typeDefinition = $ container ->getParameter ('doctrine.dbal.connection_factory.types ' );
37
+
38
+ if (!isset ($ typeDefinition ['uuid ' ])) {
39
+ $ typeDefinition ['uuid ' ] = ['class ' => UuidType::class];
40
+ }
41
+
42
+ if (!isset ($ typeDefinition ['ulid ' ])) {
43
+ $ typeDefinition ['ulid ' ] = ['class ' => UlidType::class];
44
+ }
45
+
46
+ $ container ->setParameter ('doctrine.dbal.connection_factory.types ' , $ typeDefinition );
47
+ }
48
+ }
You can’t perform that action at this time.
0 commit comments