public function run($parameters) { $name = $this->getOption(array('table-name', 1)); $schema = $this->getOption('schema'); $scaffoldBuilder = new \Phalcon\Builder\Scaffold(array('name' => $name, 'schema' => $schema, 'force' => $this->isReceivedOption('force'), 'genSettersGetters' => $this->isReceivedOption('get-set'), 'directory' => $this->getOption('directory'))); return $scaffoldBuilder->build(); }
/** * Generate Scaffold */ public function generateAction() { if ($this->request->isPost()) { $schema = $this->request->getPost('schema', 'string'); $tableName = $this->request->getPost('tableName', 'string'); $version = $this->request->getPost('version', 'string'); $force = $this->request->getPost('force', 'int'); $genSettersGetters = $this->request->getPost('genSettersGetters', 'int'); try { $scaffoldBuilder = new \Phalcon\Builder\Scaffold(array('name' => $tableName, 'schema' => $schema, 'force' => $force, 'genSettersGetters' => $genSettersGetters, 'directory' => null)); $scaffoldBuilder->build(); $this->flash->success('Scaffold for table "' . $tableName . '" was generated successfully'); } catch (BuilderException $e) { $this->flash->error($e->getMessage()); } } return $this->dispatcher->forward(array('controller' => 'scaffold', 'action' => 'index')); }