Merge branch '2.7' into 2.8
* 2.7: added checks for public services on compiler passes that use service id and not references
This commit is contained in:
commit
b14c8e750b
@ -28,7 +28,17 @@ class AddConstraintValidatorsPass implements CompilerPassInterface
|
||||
$validators[$attributes[0]['alias']] = $id;
|
||||
}
|
||||
|
||||
$validators[$container->getDefinition($id)->getClass()] = $id;
|
||||
$definition = $container->getDefinition($id);
|
||||
|
||||
if (!$definition->isPublic()) {
|
||||
throw new InvalidArgumentException(sprintf('The service "%s" must be public as it can be lazy-loaded.', $id));
|
||||
}
|
||||
|
||||
if ($definition->isAbstract()) {
|
||||
throw new InvalidArgumentException(sprintf('The service "%s" must not be abstract as it can be lazy-loaded.', $id));
|
||||
}
|
||||
|
||||
$validators[$definition->getClass()] = $id;
|
||||
}
|
||||
|
||||
$container->getDefinition('validator.validator_factory')->replaceArgument(1, $validators);
|
||||
|
@ -78,7 +78,7 @@ class FrameworkBundle extends Bundle
|
||||
// but as late as possible to get resolved parameters
|
||||
$container->addCompilerPass(new RegisterListenersPass(), PassConfig::TYPE_BEFORE_REMOVING);
|
||||
$container->addCompilerPass(new TemplatingPass());
|
||||
$container->addCompilerPass(new AddConstraintValidatorsPass());
|
||||
$container->addCompilerPass(new AddConstraintValidatorsPass(), PassConfig::TYPE_BEFORE_REMOVING);
|
||||
$container->addCompilerPass(new AddValidatorInitializersPass());
|
||||
$container->addCompilerPass(new AddConsoleCommandPass());
|
||||
$container->addCompilerPass(new FormPass());
|
||||
|
Reference in New Issue
Block a user