/** * 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 add any params * present in the payload to the *request* object stored * within the service manager. * * It will then execute the controllers preAction method, the action * method provided by the payload, then postAction. * * @return Proem\Api\Dispatch\Standard */ public function dispatch() { if ($this->assets->has('request') && $this->payload->get('params') && is_array($this->payload->get('params'))) { $this->assets->get('request')->setGetData($this->payload->get('params')); } $this->class->dispatch($this->action); return $this; }