You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to access filter service, but I can't do it, and I can't find anything related to the services in the documentation.
<?php
namespace App\EventSubscriber;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use App\Service\Configuration;
use Vich\UploaderBundle\Event\Event;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Liip\ImagineBundle\Service\FilterService;
use Liip\ImagineBundle\Factory\Config\FilterFactoryInterface;
use Liip\ImagineBundle\Controller\ImagineController;
class VichSubscriber implements EventSubscriberInterface
{
private $configuration;
private $container;
private $filterService;
public function __construct(FilterService $filterService,Configuration $configuration, ContainerInterface $container)
{
$this->configuration = $configuration;
$this->container = $container;
$this->filterService = $filterService;
}
public static function getSubscribedEvents()
{
return array(
'vich_uploader.post_upload' => 'onVichUploaderPostUpload',
);
}
public function onVichUploaderPostUpload(Event $event)
{
$imageName = $event->getObject()->getImageName();
$path = $event->getMapping()->getUploadDestination();
$resourcePath = $this->filterService->getUrlOfFilteredImage($path.$imageName, 'my_thumb');
dd($resourcePath);
}
}
Error:
Cannot autowire service "App\EventSubscriber\VichSubscriber": argument "$filterService" of method "__construct()" references class "Liip\ImagineBundle\Service\FilterService" but no such service exists. You should maybe alias this class to the existing "liip_imagine.service.filter" service.
The "liip_imagine.service.filter" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.
The message says to use dependency injection, but it's what I used before and it doesn't work either, so I'm missing out?
The text was updated successfully, but these errors were encountered:
I'm trying to access filter service, but I can't do it, and I can't find anything related to the services in the documentation.
Error:
Cannot autowire service "App\EventSubscriber\VichSubscriber": argument "$filterService" of method "__construct()" references class "Liip\ImagineBundle\Service\FilterService" but no such service exists. You should maybe alias this class to the existing "liip_imagine.service.filter" service.
Then trying what it says in the configuration.
$imagine = $this ->container->get('liip_imagine.service.filter');
Error:
The "liip_imagine.service.filter" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.
The message says to use dependency injection, but it's what I used before and it doesn't work either, so I'm missing out?
The text was updated successfully, but these errors were encountered: