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)
2828 $ validators [$ attributes [0 ]['alias ' ]] = $ id ;
2929 }
3030
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 ;
3242 }
3343
3444 $ 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)
7878 // but as late as possible to get resolved parameters
7979 $ container ->addCompilerPass (new RegisterListenersPass (), PassConfig::TYPE_BEFORE_REMOVING );
8080 $ container ->addCompilerPass (new TemplatingPass ());
81- $ container ->addCompilerPass (new AddConstraintValidatorsPass ());
81+ $ container ->addCompilerPass (new AddConstraintValidatorsPass (), PassConfig:: TYPE_BEFORE_REMOVING );
8282 $ container ->addCompilerPass (new AddValidatorInitializersPass ());
8383 $ container ->addCompilerPass (new AddConsoleCommandPass ());
8484 $ container ->addCompilerPass (new FormPass ());
You can’t perform that action at this time.
0 commit comments