NerdsAndCompany\Schematic\Console\App::on PHP Метод

on() публичный Метод

The event should be identified in a serviceHandle.eventName format. For example, if you want to add an event handler for {@link EntriesService::onSaveEntry()}, you would do this: php Craft::app()->on('entries.saveEntry', function(Event $event) { ... }); Note that the actual event name (saveEntry) does not need to include the “on”. By default, event handlers will not get attached if Craft is current in the middle of updating itself or a plugin. If you want the event to fire even in that condition, pass true to the $evenDuringUpdates argument.
public on ( string $event, mixed $handler )
$event string The event to listen for
$handler mixed The event handler
    public function on($event, $handler)
    {
        list($componentId, $eventName) = explode('.', $event, 2);
        $component = $this->getComponent($componentId);
        // Normalize the event name
        if (strncmp($eventName, 'on', 2) !== 0) {
            $eventName = 'on' . ucfirst($eventName);
        }
        $component->{$eventName} = $handler;
    }