| @@ 51-66 (lines=16) @@ | ||
| 48 | * @param string|null $name The name of the controller to bake. |
|
| 49 | * @return void |
|
| 50 | */ |
|
| 51 | public function main($name = null) |
|
| 52 | { |
|
| 53 | parent::main(); |
|
| 54 | $name = $this->_getName($name); |
|
| 55 | ||
| 56 | if (empty($name)) { |
|
| 57 | $this->out('Possible controllers based on your current database:'); |
|
| 58 | foreach ($this->listAll() as $table) { |
|
| 59 | $this->out('- ' . $this->_camelize($table)); |
|
| 60 | } |
|
| 61 | return true; |
|
| 62 | } |
|
| 63 | ||
| 64 | $controller = $this->_camelize($name); |
|
| 65 | $this->bake($controller); |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * Bake All the controllers at once. Will only bake controllers for models that exist. |
|
| @@ 83-97 (lines=15) @@ | ||
| 80 | * @param string|null $name The name of the table to bake. |
|
| 81 | * @return void |
|
| 82 | */ |
|
| 83 | public function main($name = null) |
|
| 84 | { |
|
| 85 | parent::main(); |
|
| 86 | $name = $this->_getName($name); |
|
| 87 | ||
| 88 | if (empty($name)) { |
|
| 89 | $this->out('Choose a model to bake from the following:'); |
|
| 90 | foreach ($this->listUnskipped() as $table) { |
|
| 91 | $this->out('- ' . $this->_camelize($table)); |
|
| 92 | } |
|
| 93 | return true; |
|
| 94 | } |
|
| 95 | ||
| 96 | $this->bake($this->_camelize($name)); |
|
| 97 | } |
|
| 98 | ||
| 99 | /** |
|
| 100 | * Generate code for the given model name. |
|