Skip to content

Commit

Permalink
add missing command configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
garak committed Apr 15, 2018
1 parent faaf662 commit 37bc4b3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DependencyInjection/VichUploaderExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 6 additions & 2 deletions Form/Type/VichFileType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 10 additions & 5 deletions Form/Type/VichImageType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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.');
}

Expand Down

0 comments on commit 37bc4b3

Please sign in to comment.