Example #1
0
 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]);
 }