예제 #1
0
 /**
  * Execute method
  *
  * @param string $name The name of the object to bake.
  * @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 = $this->_getName($name);
     $name = Inflector::camelize($name);
     $this->bake($name);
     $this->bakeTest($name);
 }
예제 #2
0
 /**
  * Execution method always used for tasks
  *
  * @param string $name The name of the table to bake.
  * @return void
  */
 public function main($name = null)
 {
     parent::main();
     $name = $this->_getName($name);
     if (empty($name)) {
         $this->out('Choose a model to bake from the following:');
         foreach ($this->listAll() as $table) {
             $this->out('- ' . $this->_camelize($table));
         }
         return true;
     }
     $this->bake($this->_camelize($name));
 }
예제 #3
0
 /**
  * Execution method always used for tasks
  *
  * @param string $type Class type.
  * @param string $name Name.
  * @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>');
     }
 }
예제 #4
0
 /**
  * Execution method always used for tasks
  *
  * @param string $name The name of the controller to bake.
  * @return void
  */
 public function main($name = null)
 {
     parent::main();
     $name = $this->_getName($name);
     if (empty($name)) {
         $this->out('Possible controllers based on your current database:');
         foreach ($this->listAll() as $table) {
             $this->out('- ' . $this->_camelize($table));
         }
         return true;
     }
     $controller = $this->_camelize($name);
     $this->bake($controller);
 }
예제 #5
0
 /**
  * Execution method always used for tasks
  * Handles dispatching to interactive, named, or all processes.
  *
  * @param string $name The name of the fixture to bake.
  * @return void
  */
 public function main($name = null)
 {
     parent::main();
     $name = $this->_getName($name);
     if (empty($name)) {
         $this->out('Choose a fixture to bake from the following:');
         foreach ($this->Model->listAll() as $table) {
             $this->out('- ' . $this->_camelize($table));
         }
         return true;
     }
     $table = null;
     if (isset($this->params['table'])) {
         $table = $this->params['table'];
     }
     $model = $this->_camelize($name);
     $this->bake($model, $table);
 }
예제 #6
0
 /**
  * Execution method always used for tasks
  *
  * @param string $name The name of the controller to bake views for.
  * @param string $template The template to bake with.
  * @param string $action The action to bake with.
  * @return mixed
  */
 public function main($name = null, $template = null, $action = null)
 {
     parent::main();
     if (empty($name)) {
         $this->out('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->_camelize($table));
         }
         return true;
     }
     $name = $this->_getName($name);
     $controller = null;
     if (!empty($this->params['controller'])) {
         $controller = $this->params['controller'];
     }
     $this->controller($name, $controller);
     $this->model($name);
     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);
         }
     }
 }