public static function configure(&$config = NULL, LogInterface &$log) { $config = new ControllerConfig($config); $log->info('[ Controller configuration ]'); do { try { $config->setName(Cmd::readInput('name>', $log)); } catch (\Exception $e) { $log->error($e->getMessage()); } } while (!$config->getName()); $controller = new Controller($config, $validate = 'soft'); AssetCli::addAssetsToObject($config, 'Add project assets', 'Add assets at a controller level. This means that every asset you add here will be present in each acton of this controller', $log); do { $log->info('Add actions to your controller.'); $opt = Cmd::selectWithKeys(array('N' => 'New Action', 'E' => 'End adding actions'), '>', $log); if (strtolower($opt) == 'e') { break; } $actionConfig = new ActionConfig(); $actionConfig->setController($controller); $config->addAction(Action::cliConfig($actionConfig, $log)); } while (TRUE); return $controller; }
public static function configure(&$config = NULL, LogInterface &$log) { $config = new ActionConfig($config); $log->info('[ Action configuration ]'); do { try { $config->setName(Cmd::readInput('name>', $log)); } catch (\Exception $e) { $log->error($e->getMessage()); } } while (!$config->getName()); $action = new Action($config, $validate = 'soft'); $help = 'Add routes at an action level. Though is not recommended, an action can have many routes.'; RouteCli::addRoutesToObject($config, $log, 'Add routes to action', $help); return $action; }