Skip to content
This repository was archived by the owner on Jul 27, 2021. It is now read-only.

Files

Latest commit

7319438 · Aug 24, 2015

History

History
35 lines (27 loc) · 791 Bytes

Event.md

File metadata and controls

35 lines (27 loc) · 791 Bytes

Event system

TBD

A module can listen to any system's events:

namespace my_company;

use atsilex\module\Module;
use Pimple\Container;
use Silex\ControllerCollection;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\Event;

class MyModule extends Module {
    protected $machineName = 'my_module';
    protected $routeFile   = true;
    
    public function subscribe(Container $container, EventDispatcherInterface $dispatcher) {
        $dispatcher
            ->addListener(
                'event_x', 
                function (Event $event) {
                    // my logic
                }
            );
    }
}

Dispatch an event

TBD.