mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-22 03:26:22 +00:00
36 lines
657 B
Markdown
36 lines
657 B
Markdown
---
|
|
date: 2020-11-17
|
|
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',
|
|
];
|
|
}
|
|
}
|
|
```
|