...
Code Block | ||
---|---|---|
| ||
<?php namespace Acme\TestBundle\EventListener; use eZ\Publish\Core\MVC\Symfony\Event\SignalEvent; use eZ\Publish\Core\MVC\Symfony\MVCEvents; use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class SignalListener implements EventSubscriberInterface { /** * @var \Psr\Log\LoggerInterface */ private $logger; public function __construct( LoggerInterface $logger ) { $this->logger = $logger; } public function onAPISignal( SignalEvent $event ) { $signal = $event->getSignal(); // You may want to check the signal type here to react accordingly $this->logger->debug( 'Received Signal: ' . print_r( $signal, true ) ); } public static function getSubscribedEvents() { return array( MVCEvents::API_SIGNAL => 'onAPISignal' ); } } |