Q:

Symfony2: event changes into listener

My "CustomEvent(.php)" class that's set in my "CustomListeren(.php)" as $event property.
On kernel.terminate the $event property changes from "CustomEvent" to "CustomListener" (empty object).
# CustomEvent.php
namespace Stackoverflow\AwesomeBundle\Event;

use Symfony\Component\EventDispatcher\Event;

class CustomEvent extends Event {

  protected $data;

  /**
   * @param Data $data
   */
  public function __construct(Data $data) {
    $this->data = $data;
  }

  /**
   * @return Data
   */
  public function getdata() {
    return $this->data;
  }
}

and
# CustomListener.php
namespace Stackoverflow\AwesomeBundle\Event;

class CustomListener {
  /**
   * @var CustomEvent
   */
  protected $event;

  /**
   * @param CustomEvent $event
   */
  public function firstTrigger(CustomEvent $event) {
    // indeed instanceof CustomEvent
    $this->event = $event;
  }

  public function secondTrigger() {
    // $this->event is now instanceof CustomListener instead of CustomEvent

    if ($this->event instanceof CustomEvent) {
      // ... code logic
    }
  }
}

my controller
# CustomController
namespace Stackoverflow\AwesomeBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Stackoverflow\AwesomeBundle\Data;
use Stackoverflow\AwesomeBundle\Event\CustomEvent;

class CustomController extends Controller {
  public function customAction(Request $request) {
   // ... code

   $data = new Data();

   $this->get('event_dispatcher')->dispatch(
     'nameIsNotImportant',
     new CustomEvent($data)
   );

   // ... code
  }
}

my bundle services.yml
parameters:
  custom.listener.class: Stackoverflow\AwesomeBundle\Event\CustomListener

services:
  custom_listener:
    class: %custom.listener.class%
    tags:
      - { name: kernel.event_listener, event: nameIsNotImportant, method: firsTrigger }
      - { name: kernel.event_listener, event: kernel.terminate, method: secondTrigger }

I did a get_class($this->event) in CustomListener::secondTrigger()
The logs show that $this->event changed into CustomListener
[2014-04-25 15:20:16] app.DEBUG: Pointer\Revlect\SecurityBundle\Event\ResetTokenEvent [] []
...
[2014-04-25 15:20:16] app.DEBUG: Pointer\Revlect\SecurityBundle\Event\ResetTokenListener [] []
[2014-04-25 15:20:16] event.DEBUG: Notified event "kernel.terminate" to listener "Stackoverflow\AwesomeBundle\Event\CustomListener::secondTrigger". [] []

In CustomListener::secondTrigger() $this->event must be instanceof CustomEvent.
Do I miss a puzzle piece???

A:

I've changed my method-name from "sendMail" into "sendsMail"..
So if you encounter such issue try changing your method name.

