/**
  * Execute method
  *
  * @return void
  */
 public function main($name = null)
 {
     parent::main();
     if (empty($name)) {
         return $this->error('You must provide a name to bake a ' . $this->name());
     }
     $name = Inflector::camelize($name);
     $this->bake($name);
     $this->bakeTest($name);
 }
Beispiel #2
0
 /**
  * Execution method always used for tasks
  *
  * @return void
  */
 public function main($name = null)
 {
     parent::main();
     if (empty($name)) {
         $this->out(__d('cake_console', 'Choose a model to bake from the following:'));
         foreach ($this->listAll() as $table) {
             $this->out('- ' . $this->_modelName($table));
         }
         return true;
     }
     $this->bake($this->_modelName($name));
 }
 /**
  * Execution method always used for tasks
  *
  * @return void
  */
 public function main($name = null)
 {
     parent::main();
     if (empty($name)) {
         $this->out(__d('cake_console', 'Possible controllers based on your current database:'));
         foreach ($this->listAll() as $table) {
             $this->out('- ' . $this->_controllerName($table));
         }
         return true;
     }
     $controller = $this->_controllerName($name);
     $this->bake($controller);
 }
Beispiel #4
0
 /**
  * Execution method always used for tasks
  *
  * @return void
  */
 public function main($type = null, $name = null)
 {
     parent::main();
     if (empty($type) && empty($name)) {
         return $this->outputTypeChoices();
     }
     if (empty($name)) {
         return $this->outputClassChoices($type);
     }
     if ($this->bake($type, $name)) {
         $this->out('<success>Done</success>');
     }
 }
 /**
  * Execution method always used for tasks
  * Handles dispatching to interactive, named, or all processes.
  *
  * @return void
  */
 public function main($name = null)
 {
     parent::main();
     if (empty($name)) {
         $this->out(__d('cake_console', 'Choose a fixture to bake from the following:'));
         foreach ($this->Model->listAll() as $table) {
             $this->out('- ' . $this->_modelName($table));
         }
         return true;
     }
     $table = null;
     if (isset($this->params['table'])) {
         $table = $this->params['table'];
     }
     $model = $this->_modelName($name);
     $this->bake($model, $table);
 }
Beispiel #6
0
 /**
  * Execution method always used for tasks
  *
  * @return mixed
  */
 public function main($name = null, $template = null, $action = null)
 {
     parent::main();
     if (empty($name)) {
         $this->out(__d('cake_console', 'Possible tables to bake views for based on your current database:'));
         $this->Model->connection = $this->connection;
         foreach ($this->Model->listAll() as $table) {
             $this->out('- ' . $this->_controllerName($table));
         }
         return true;
     }
     $controller = null;
     if (!empty($this->params['controller'])) {
         $controller = $this->params['controller'];
     }
     $this->controller($name, $controller);
     if (isset($template)) {
         $this->template = $template;
     }
     if (!$action) {
         $action = $this->template;
     }
     if ($action) {
         return $this->bake($action, true);
     }
     $vars = $this->_loadController();
     $methods = $this->_methodsToBake();
     foreach ($methods as $method) {
         $content = $this->getContent($method, $vars);
         if ($content) {
             $this->bake($method, $content);
         }
     }
 }