Esempio n. 1
0
 function dispatch($uri)
 {
     $this->request->setUri($uri);
     $event = new \Zend\Mvc\MvcEvent();
     $event->setRouter($this->router);
     $event->setRequest($this->request);
     $this->events->trigger('route', $event);
     $this->routeMatch = $event->getRouteMatch();
 }
<?php

require "vendor/autoload.php";
$myEventManager = new \Zend\EventManager\EventManager();
$listener = function ($e) {
    $p = $e->getParams();
    echo "Bonjour {$p['0']}\n";
};
$autre = function ($e) {
    echo "bye\n";
};
$myEventManager->attach('lundi', $listener, 1);
$myEventManager->attach('lundi', $autre, 2);
$myEventManager->trigger('lundi', null, array('Nous sommes lundi'));
 public function notify($event)
 {
     $this->eventManager->trigger($event, $this);
 }
 public function benchmarkZendFrameworkEventManager($b)
 {
     $eventManager = new \Zend\EventManager\EventManager();
     $eventManager->attach("post-save", function ($assert) {
     });
     for ($i = 0; $i < $b->times(); $i++) {
         $eventManager->trigger("post-save", $this, ["override"]);
     }
 }