Beispiel #1
0
 public function run($argc, $argv)
 {
     switch ($argv[2]) {
         case 'scaffold':
             $generator = new generator\Scaffold($this);
             $generator->generate($argv[3], array_slice($argv, 4));
             break;
         case 'controller':
             $generator = new generator\Controller($this);
             $generator->generate($argv[3]);
             break;
         case 'model':
             $generator = new generator\Model($this);
             $generator->generate($argv[3]);
             break;
         case 'views':
             $generator = new generator\Views($this);
             $generator->generate($argv[3]);
             break;
         case 'migration':
             $generator = new generator\Migration($this);
             $generator->generate($argv[3], array_slice($argv, 4));
             break;
     }
 }
Beispiel #2
0
 public function generate($name, $colDefs = array())
 {
     if (empty($colDefs)) {
         throw new Exception('Scaffold generator requires a list of columns/attributes');
     }
     $name = Inflector::pluralize($name);
     $migrationGen = new Migration($this->command);
     $migrationGen->generate("create_{$name}", $colDefs);
     $modelGen = new Model($this->command);
     $modelGen->generate($name);
     $controllerGen = new Controller($this->command);
     $controllerGen->generate($name);
     $viewsGen = new Views($this->command);
     $viewsGen->generate($name, $colDefs);
 }