コード例 #1
0
 /**
  * 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));
 }