2

I have upgraded Symfony from 3.2 to 3.3. I have readed this : https://github.com/symfony/symfony/blob/master/UPGRADE-3.3.md

But now, I have this error :

Type error: Argument 2 passed to AppBundle\EventListener\ForumListener::__construct() must be an instance of Symfony\Component\Cache\Adapter\FilesystemAdapter, instance of Symfony\Component\Cache\Adapter\TraceableAdapter given, called in /var/www/symfony/WikiSport/var/cache/dev/appDevDebugProjectContainer.php on line 612

I don't understand because in UPGRADE-3.3.md, There is no information for FilesystemAdapter or TraceableAdapter.

ForumListener.php :

use Symfony\Component\Cache\Adapter\FilesystemAdapter;

class ForumListener
{
    private $cache;

    public function __construct(EntityManager $entityManager, FilesystemAdapter $cache)
    {
        $this->entityManager = $entityManager;
        $this->cache = $cache;
    }

And services.yml :

app.forum_listener:
    class: AppBundle\EventListener\ForumListener
    autowire: true
    public: true
    tags:
        - { name: kernel.event_listener, event: kernel.controller, method: onKernelController }

Can you help me ? Thank you very much :)

Gaylord.P
  • 1,539
  • 2
  • 24
  • 54
  • Autowire still has a few kinks to work out. Easiest approach is to just go back to manual wiring. Otherwise, dig into the new container docs. Also wondering if there is a cache interface? Just using the interface in your listener might do the trick. – Cerad Jun 23 '17 at 13:53
  • Did you manage to solve this? – Tomas Votruba Oct 24 '17 at 13:21

0 Answers0