wiki/content/20201117115146-consoleevents_signal.md

37 lines
657 B
Markdown
Raw Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-29 18:27:12 +00:00
date: 2020-11-17
2024-05-06 20:40:05 +00:00
id: 03320caf-dc21-416f-9d74-dc1bc219101e
title: "ConsoleEvents::SIGNAL"
---
# Description
[Event](20201113175016-events) to handle application command
[signals](20201117114930-console_signals).
# Syntax
``` php
// ...
use Symfony\Component\Console\Event\ConsoleSignalEvent;
class SignalSubscriber implements EventSubscriberInterface
{
// ...
public function handleSignal(ConsoleSignalEvent $event)
{
$signal = $event->getHandlingSignal();
// ...
}
public static function getSubscribedEvents()
{
return [
ConsoleEvents::SIGNAL => 'handleSignal',
];
}
}
```