public function execute(Request $request) { $this->trigger(self::BEFORE_EXECUTE_SERVICE, [$request, $this->response]); if (!$request->isAllowed()) { $this->trigger(self::NOT_ALLOWED, [$request, $this->response]); return null; } $class_name = String::underscoreToCamelCase($request->getService()); $group_name = $request->getGroup() ? String::underscoreToCamelCase($request->getGroup()) . '\\' : ''; $service_class = $this->getServicePrefix() . $group_name . $class_name; $this->validateClass($service_class); $reflector = new \ReflectionClass($service_class); $service = $reflector->newInstanceArgs([$request->getData(), $this->response]); $this->trigger(self::AFTER_EXECUTE_SERVICE, [$request, $this->response]); $this->routeRequest($request, $service); $this->response->render(); $this->trigger(self::REQUEST_COMPLETE, [$request, $this->response]); }
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ include 'Request.php'; //include 'AdminActions.php'; $request = new Request(); $class = $request->getGroup() . 'Actions'; require_once $class . '.php'; $cmd = $request->getCommand(); $action = new $class(); $action->{$cmd}($request);