public function bakeActions($controllerName, $admin = null, $wannaUseSession = true) { $currentModelName = $modelImport = $this->_modelName($controllerName); $modelObj = ClassRegistry::init($currentModelName); $info = $artigo = null; if (isset($modelObj->genero)) { $artigo = $modelObj->genero == 'm' ? 'o' : 'a'; } if (isset($modelObj->info)) { $info = $modelObj->info; } $this->Template->set(compact('artigo', 'info')); return parent::bakeActions($controllerName, $admin, $wannaUseSession); }
/** * Main function called by shell */ function execute() { parent::loadTasks(); // Get the array of actions to bake into the controller $actions = $this->ViewMultiple->getActions(); // @todo Quick fix for switching on/off admin/non admin actions - to be // replaced by more granular control $admin = $this->getAdmin(); $nonAdminActions = $adminActions = false; foreach ($actions as $action) { if (strpos($action, $admin) !== false) { $adminActions = true; } else { $nonAdminActions = true; } } // Get the array of controllers to bake the selected actions for $controllerNames = $this->getNames(); // For each controller foreach ($controllerNames as $controllerName) { // @todo Quick fix for switching on/off admin/non admin actions - to be // replaced by more granular control $actions = ''; if ($nonAdminActions) { $actions .= $this->bakeActions($controllerName); } if ($adminActions) { $actions .= $this->bakeActions($controllerName, $admin); } // Bake the controller $baked = $this->bake($controllerName, $actions); // If baked OK check if user wants controller unit test baked if ($baked && $this->_checkUnitTest()) { $this->bakeTest($controllerName); } $this->hr(); } $this->out(__("Controller Baking Complete.\n", true)); }
/** * get the option parser. * * @return void */ public function getOptionParser() { $parser = parent::getOptionParser(); return $parser->addOption('plugin', array('short' => 'l', 'help' => __d('cake_console', 'Plugin.')))->addOption('appTestCase', array('short' => 'z', 'help' => __d('cake_console', 'App test case.')))->addOption('noAppTestCase', array('short' => 'n', 'help' => __d('cake_console', 'App test case.')))->addOption('slug', array('short' => 's', 'boolean' => true, 'help' => __d('cake_console', 'Use slug.')))->addOption('parentSlug', array('short' => 'f', 'boolean' => true, 'help' => __d('cake_console', 'Use slug.')))->addOption('user', array('short' => 'u', 'help' => __d('cake_console', 'Use user model.')))->addOption('parent', array('short' => 'r', 'help' => __d('cake_console', 'Use parent model.')))->addOption('theme', array('short' => 't', 'help' => __d('cake_console', 'theme.')))->addOption('subthemes', array('short' => 'b', 'help' => __d('cake_console', 'subthemes.')))->addOption('property', array('short' => 'y', 'boolean' => true, 'help' => __d('cake_console', 'generate IDE properties hints for model relations'))); }