<?php
namespace App\EventListener;
use Vich\UploaderBundle\Event\Event;
use Vich\UploaderBundle\Handler\UploadHandler;
class VichUploaderUpdateListener
{
private $uploadHandler;
public function __construct(UploadHandler $uploadHandler)
{
$this->uploadHandler = $uploadHandler;
}
public function onVichUploaderPreUpload(Event $event)
{
$object = $event->getObject();
$this->uploadHandler->remove($object, 'imageFile');
}
}