From 37bc4b3264a0e22608a56406d5019b26864b9553 Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Sun, 15 Apr 2018 16:01:01 +0200 Subject: [PATCH] add missing command configuration --- DependencyInjection/VichUploaderExtension.php | 2 +- Form/Type/VichFileType.php | 8 ++++++-- Form/Type/VichImageType.php | 15 ++++++++++----- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/DependencyInjection/VichUploaderExtension.php b/DependencyInjection/VichUploaderExtension.php index c8233f39..5ef584b1 100644 --- a/DependencyInjection/VichUploaderExtension.php +++ b/DependencyInjection/VichUploaderExtension.php @@ -60,7 +60,7 @@ protected function loadServicesFiles(ContainerBuilder $container, array $config) $toLoad = [ 'adapter.xml', 'listener.xml', 'storage.xml', 'injector.xml', - 'mapping.xml', 'factory.xml', 'namer.xml', 'handler.xml', + 'mapping.xml', 'factory.xml', 'namer.xml', 'handler.xml', 'command.xml' ]; foreach ($toLoad as $file) { $loader->load($file); diff --git a/Form/Type/VichFileType.php b/Form/Type/VichFileType.php index 4db2ba38..9899bf5b 100644 --- a/Form/Type/VichFileType.php +++ b/Form/Type/VichFileType.php @@ -46,8 +46,12 @@ class VichFileType extends AbstractType */ protected $propertyAccessor; - public function __construct(StorageInterface $storage, UploadHandler $handler, PropertyMappingFactory $factory, PropertyAccessorInterface $propertyAccessor = null) - { + public function __construct( + StorageInterface $storage, + UploadHandler $handler, + PropertyMappingFactory $factory, + PropertyAccessorInterface $propertyAccessor = null + ) { $this->storage = $storage; $this->handler = $handler; $this->factory = $factory; diff --git a/Form/Type/VichImageType.php b/Form/Type/VichImageType.php index a63ce537..d11588f3 100644 --- a/Form/Type/VichImageType.php +++ b/Form/Type/VichImageType.php @@ -20,12 +20,17 @@ class VichImageType extends VichFileType { /** - * @var CacheManager + * @var CacheManager|null */ private $cacheManager; - public function __construct(StorageInterface $storage, UploadHandler $handler, PropertyMappingFactory $factory, PropertyAccessorInterface $propertyAccessor = null, CacheManager $cacheManager = null) - { + public function __construct( + StorageInterface $storage, + UploadHandler $handler, + PropertyMappingFactory $factory, + PropertyAccessorInterface $propertyAccessor = null, + CacheManager $cacheManager = null + ) { parent::__construct($storage, $handler, $factory, $propertyAccessor); $this->cacheManager = $cacheManager; } @@ -55,9 +60,9 @@ public function buildView(FormView $view, FormInterface $form, array $options): $view->vars['image_uri'] = null; $view->vars['download_uri'] = null; - if ($object) { + if (null !== $object) { if ($options['imagine_pattern']) { - if (!$this->cacheManager) { + if (null === $this->cacheManager) { throw new \RuntimeException('LiipImagineBundle must be installed and configured for using "imagine_pattern" option.'); }