/** * Metod called to dispatch an action. */ public function dispatch($action) { $action = strtolower($action); if ($this->assets->provides('events', '\\Proem\\Signal\\Manager\\Template')) { $this->assets->get('events')->trigger((new Bootstrap('proem.pre.action.' . $action))->setServiceManager($this->assets)); } $method = $action . 'Action'; $result = $this->{$method}(); if ($this->assets->provides('events', '\\Proem\\Signal\\Manager\\Template')) { $this->assets->get('events')->trigger((new Bootstrap('proem.post.action.' . $action))->setServiceManager($this->assets)); } return $result; }
/** * Dispatch the current controller stored within * the $class property. * * Prior to dispatch this method will send the Payload to the Request * object stored within the Service Manager. At this point we also call * the Payload's prepare method, which prepares the Payload for the Request. * * It will then execute the controllers preAction method, the action * method provided by the payload, then postAction. * * @return Proem\Dispatch\Standard */ public function dispatch() { if ($this->assets->has('request')) { $this->assets->get('request')->injectPayload($this->payload->prepare()); } $this->class->dispatch($this->action); return $this; }
/** * Called after outBound. * * @param Proem\Api\Service\Manager\Template $assets * @triggers Proem\Api\Bootstrap\Signal\Event\Bootstrap proem.pre.in.router */ public function postOut(Manager $assets) { if ($assets->provides('events', 'Proem\\Signal\\Manager\\Template')) { $assets->get('events')->trigger((new Bootstrap('proem.post.out.router'))->setServiceManager($assets)); } }
public function init(Manager $assets, $env = null) { $assets->get('events')->attach('proem.pre.in.router', [$this, 'loadRoutes']); }
public function init(Manager $serviceManager, $env = null) { $serviceManager->get('events')->attach('proem.pre.in.dispatch', [$this, 'pre']); }