Ejemplo n.º 1
0
 /**
  * Execution method always used for tasks
  *
  * @return void
  */
 public function execute()
 {
     parent::execute();
     if (empty($this->args)) {
         $this->_interactive();
     }
     if (!empty($this->args[0])) {
         $this->interactive = false;
         if (!isset($this->connection)) {
             $this->connection = 'default';
         }
         if (strtolower($this->args[0]) == 'all') {
             return $this->all();
         }
         $model = $this->_modelName($this->args[0]);
         $this->listAll($this->connection);
         $useTable = $this->getTable($model);
         $object = $this->_getModelObject($model, $useTable);
         if ($this->bake($object, false)) {
             if ($this->_checkUnitTest()) {
                 $this->bakeFixture($model, $useTable);
                 $this->bakeTest($model);
             }
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Execution method always used for tasks
  *
  * @return void
  */
 public function execute()
 {
     parent::execute();
     if (empty($this->args)) {
         $this->_interactive();
     }
     if (count($this->args) == 1) {
         $this->_interactive($this->args[0]);
     }
     if (count($this->args) > 1) {
         $type = Inflector::classify($this->args[0]);
         if ($this->bake($type, $this->args[1])) {
             $this->out('<success>Done</success>');
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Execution method always used for tasks
  * Handles dispatching to interactive, named, or all processes.
  *
  * @return void
  */
 public function execute()
 {
     parent::execute();
     if (empty($this->args)) {
         $this->_interactive();
     }
     if (isset($this->args[0])) {
         $this->interactive = false;
         if (!isset($this->connection)) {
             $this->connection = 'default';
         }
         if (strtolower($this->args[0]) === 'all') {
             return $this->all();
         }
         $model = $this->_modelName($this->args[0]);
         $this->bake($model);
     }
 }
Ejemplo n.º 4
0
 /**
  * Execution method always used for tasks
  *
  * @return mixed
  */
 public function execute()
 {
     parent::execute();
     if (empty($this->args)) {
         $this->_interactive();
     }
     if (empty($this->args[0])) {
         return;
     }
     if (!isset($this->connection)) {
         $this->connection = 'default';
     }
     $action = null;
     $this->controllerName = $this->_controllerName($this->args[0]);
     $this->Project->interactive = false;
     if (strtolower($this->args[0]) === 'all') {
         return $this->all();
     }
     if (isset($this->args[1])) {
         $this->template = $this->args[1];
     }
     if (isset($this->args[2])) {
         $action = $this->args[2];
     }
     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);
         }
     }
 }
Ejemplo n.º 5
0
/**
 * Execution method always used for tasks
 *
 * @return void
 */
	public function execute() {
		parent::execute();
		if (empty($this->args)) {
			return $this->_interactive();
		}

		if (isset($this->args[0])) {
			if (!isset($this->connection)) {
				$this->connection = 'default';
			}
			if (strtolower($this->args[0]) === 'all') {
				return $this->all();
			}

			$controller = $this->_controllerName($this->args[0]);
			$actions = '';

			if (!empty($this->params['public'])) {
				$this->out(__d('cake_console', 'Baking basic crud methods for ') . $controller);
				$actions .= $this->bakeActions($controller);
			}
			if (!empty($this->params['admin'])) {
				$admin = $this->Project->getPrefix();
				if ($admin) {
					$this->out(__d('cake_console', 'Adding %s methods', $admin));
					$actions .= "\n" . $this->bakeActions($controller, $admin);
				}
			}
			if (empty($actions)) {
				$actions = 'scaffold';
			}

			if ($this->bake($controller, $actions)) {
				if ($this->_checkUnitTest()) {
					$this->bakeTest($controller);
				}
			}
		}
	}
Ejemplo n.º 6
0
 /**
  * Execution method always used for tasks
  *
  * @return void
  */
 public function execute()
 {
     parent::execute();
 }