public function generate(array $requests, ParametersManager $parManager)
 {
     $controllers = array();
     foreach (ControllerRequest::filter($requests) as $request) {
         if (!isset($controllers[$request->getController()])) {
             $controllers[$request->getController()] = array('name' => $request->getController(), 'actions' => array());
         }
         $controllers[$request->getController()]['actions'][] = array('name' => $request->getAction(), 'code' => $request->getCode());
     }
     $twig = new TwigEngine(__DIR__);
     foreach ($controllers as $controller) {
         $this->create('src/App/Controller/', $controller['name'] . 'Controller.php', $twig->render('controller.php.twig', array('controller' => $controller)));
     }
 }
Esempio n. 2
0
 private function createController($key, $webpage)
 {
     $controller = new ControllerRequest();
     $controller->setId('fminor.webpage.' . $key . '.controller');
     $controller->setController('Default');
     $controller->setAction($key);
     $controller->setCode('return $this->render(\'fminor.webpage.' . $key . '.template.php\');');
     return $controller;
 }