title: Symfony: Must be an instance of Twig_Environment
body: <p>I am trying to implement a password resset feature to an already made Symfony app. I think I am almost there ... But i am pretty new to Symfony and I am still searching my self arround ... I have a view that send a JSON post to a controller but it returns the following message:</p>
  
  <pre><code>Type error: Argument 1 passed to AppBundle\Event\ForgotPasswordEventListener::__construct() must be an instance of Twig_Environment, instance of Doctrine\ORM\EntityManager given, called in /home/***/public_html/intranet/var/cache/prod/ContainerJxqbmi7/getApp_Listener_ForgotPasswordService.php on line 8
  </code></pre>
  
  <p>This is my controller:</p>
  
  <pre><code>&lt;?php
  
  namespace AppBundle\Event;
  use CoopTilleuls\ForgotPasswordBundle\Event\ForgotPasswordEvent;
  
  class ForgotPasswordEventListener
  {
  
      private $twig;
      private $mailer;
      private $manager;
  
      public function __construct(\Twig_Environment $twig, \Swift_Mailer $mailer, \Doctrine\ORM\EntityManager $manager)
      {
          $this-&gt;templating = $twig;
          $this-&gt;mailer = $mailer;
          $this-&gt;manager=$manager;
      }
  
      /**
       * @param ForgotPasswordEvent $event
       */
      public function onCreateToken(ForgotPasswordEvent $event)
      {
          $passwordToken = $event-&gt;getPasswordToken();
          $user = $passwordToken-&gt;getUser();
  
          $swiftMessage = new \Swift_Message(
              'Reset of your password',
              $this-&gt;templating-&gt;render(
               'security/forgot-password.html.twig',
                  [
                      'reset_password_url' =&gt; sprintf('http://www.example.com/forgot-password/%s', $passwordToken-&gt;getToken()),
                  ]
              )
          );
  
          $swiftMessage-&gt;setFrom('no-reply@example.com');
          $swiftMessage-&gt;setTo($user-&gt;getEmail());
          $swiftMessage-&gt;setContentType('text/html');
          if (0 === $this-&gt;mailer-&gt;send($swiftMessage)) {
              throw new \RuntimeException('Unable to send email');
          }
      }
  
      /**
       * @param ForgotPasswordEvent $event
       */
  
      public function onUpdatePassword(ForgotPasswordEvent $event)
      {
          $passwordToken = $event-&gt;getPasswordToken();
          $user = $passwordToken-&gt;getUser();
          $user-&gt;setPlainPassword($event-&gt;getPassword());
          $this-&gt;manager-&gt;persist($user);
      }
  }
  </code></pre>
  
  <p>This is my service:</p>
  
  <pre><code>app.listener.forgot_password:
      class: AppBundle\Event\ForgotPasswordEventListener
      arguments:
          templating: "@twig"
          mailer:     "@mailer"
          manager:    "@doctrine.orm.entity_manager"
      tags:
          - { name: kernel.event_listener, event: coop_tilleuls_forgot_password.create_token, method: onCreateToken}
          - { name: templating.helper, alias: templating, event: coop_tilleuls_forgot_password.create_token, method: onCreateToken}
          - { name: kernel.event_listener, event: coop_tilleuls_forgot_password.update_password, method: onUpdatePassword }
  </code></pre>
  
  <p>I am really don't know what I am doing wrong. Thx for your help!</p>