File tree 2 files changed +12
-2
lines changed
src/Symfony/Bundle/FrameworkBundle
DependencyInjection/Compiler
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,17 @@ public function process(ContainerBuilder $container)
28
28
$ validators [$ attributes [0 ]['alias ' ]] = $ id ;
29
29
}
30
30
31
- $ validators [$ container ->getDefinition ($ id )->getClass ()] = $ id ;
31
+ $ definition = $ container ->getDefinition ($ id );
32
+
33
+ if (!$ definition ->isPublic ()) {
34
+ throw new InvalidArgumentException (sprintf ('The service "%s" must be public as it can be lazy-loaded. ' , $ id ));
35
+ }
36
+
37
+ if ($ definition ->isAbstract ()) {
38
+ throw new InvalidArgumentException (sprintf ('The service "%s" must not be abstract as it can be lazy-loaded. ' , $ id ));
39
+ }
40
+
41
+ $ validators [$ definition ->getClass ()] = $ id ;
32
42
}
33
43
34
44
$ container ->getDefinition ('validator.validator_factory ' )->replaceArgument (1 , $ validators );
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ public function build(ContainerBuilder $container)
75
75
// but as late as possible to get resolved parameters
76
76
$ container ->addCompilerPass (new RegisterListenersPass (), PassConfig::TYPE_BEFORE_REMOVING );
77
77
$ container ->addCompilerPass (new TemplatingPass ());
78
- $ container ->addCompilerPass (new AddConstraintValidatorsPass ());
78
+ $ container ->addCompilerPass (new AddConstraintValidatorsPass (), PassConfig:: TYPE_BEFORE_REMOVING );
79
79
$ container ->addCompilerPass (new AddValidatorInitializersPass ());
80
80
$ container ->addCompilerPass (new AddConsoleCommandPass ());
81
81
$ container ->addCompilerPass (new FormPass ());
You can’t perform that action at this time.
0 commit comments