I have the following class:
EmailNotification
namespace App\Component\Notification\RealTimeNotification;
use Symfony\Bridge\Twig\TwigEngine;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use App\Component\Notification\NotificationInterface;
class EmailNotification implements NotificationInterface
{
private $logNotification;
public function __construct(LogNotification $logNotification, \Swift_Mailer $mailer, EngineInterface $twigEngine)
{
$this->logNotification = $logNotification;
}
public function send(array $options): void
{
$this->logNotification->send($options);
dump('Sent to email');
}
}
I have the following service definition on my yml:
app.email_notification:
class: App\Component\Notification\RealTimeNotification\EmailNotification
decorates: app.log_notification
decoration_inner_name: app.log_notification.inner
arguments: ['@app.log_notification.inner', '@mailer', '@templating']
However, when i tried to run my app it throws an Exception saying:
Cannot autowire service "App\Component\Notification\RealTimeNotification\EmailNotification": argument "$twigEngine" of method "__construct()" has type "Symfony\Bundle\FrameworkBundle\Templating\EngineInterface" but this class was not found.
Why is that so?
Thanks!