[FWBundle] Throw if PropertyInfo is enabled, but the component isn't installed

This commit is contained in:
Kévin Dunglas 2018-10-02 17:56:33 +02:00
parent 44ce4dd625
commit 41fd0a881e
No known key found for this signature in database
GPG Key ID: 4D04EBEF06AAF3A6

View File

@ -61,6 +61,7 @@ use Symfony\Component\Lock\StoreInterface;
use Symfony\Component\PropertyAccess\PropertyAccessor;
use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
@ -296,7 +297,7 @@ class FrameworkExtension extends Extension
}
if ($this->isConfigEnabled($container, $config['property_info'])) {
$this->registerPropertyInfoConfiguration($config['property_info'], $container, $loader);
$this->registerPropertyInfoConfiguration($container, $loader);
}
if ($this->isConfigEnabled($container, $config['lock'])) {
@ -1543,8 +1544,12 @@ class FrameworkExtension extends Extension
}
}
private function registerPropertyInfoConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
private function registerPropertyInfoConfiguration(ContainerBuilder $container, XmlFileLoader $loader)
{
if (!interface_exists(PropertyInfoExtractorInterface::class)) {
throw new LogicException('PropertyInfo support cannot be enabled as the PropertyInfo component is not installed. Try running "composer require symfony/property-info".');
}
$loader->load('property_info.xml');
$container->getDefinition('property_info')->setPrivate(true);