File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
DependencyInjection/Compiler Expand file tree Collapse file tree 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 @@ -78,7 +78,7 @@ public function build(ContainerBuilder $container)
78
78
// but as late as possible to get resolved parameters
79
79
$ container ->addCompilerPass (new RegisterListenersPass (), PassConfig::TYPE_BEFORE_REMOVING );
80
80
$ container ->addCompilerPass (new TemplatingPass ());
81
- $ container ->addCompilerPass (new AddConstraintValidatorsPass ());
81
+ $ container ->addCompilerPass (new AddConstraintValidatorsPass (), PassConfig:: TYPE_BEFORE_REMOVING );
82
82
$ container ->addCompilerPass (new AddValidatorInitializersPass ());
83
83
$ container ->addCompilerPass (new AddConsoleCommandPass ());
84
84
$ container ->addCompilerPass (new FormPass ());
You can’t perform that action at this time.
0 commit comments