private function validate($obj)
 {
     try {
         \Framework\Core\Annotations\AnnotationLoader::init($obj, get_called_class(), true);
     } catch (\Exception $e) {
         $this->addError($e->getMessage());
         $this->isValid = false;
     }
 }
Exemple #2
0
 private function initController()
 {
     try {
         $controllerName = $this->controllersNamespace . $this->controllerName . $this->controllersSuffix;
         $this->controller = new $controllerName();
         \Framework\Core\Annotations\AnnotationLoader::init($this->controller, $controllerName, false, $this->actionName);
     } catch (\Exception $e) {
         throw new \Exception($e->getMessage(), 404);
     }
 }
<?php

namespace Framework\Config;

\Framework\Core\Annotations\AnnotationLoader::scanAnnotatedRoutes();
//as well as annotations, custom routes can be added here
//using the pattern $GLOBALS['router']->addRoute("{method}", "{route}", "{Controller@Action}");
$GLOBALS['router']->addRoute("get", "/register", "UserController@getRegister");
$GLOBALS['router']->addRoute("post", "/register", "UserController@postRegister");