core/classes/Console.class.php
public function create($args){

        if($args[0] == 'model'){

            if(!isset($args[1])){
                echo 'You must specify a table to build the model from' . PHP_EOL;
                exit;
            }//if

            $table = $args[1];

            $templatePath = isset($args[2]) ? $args[2] : 'app/config/model.format';
            $outputPath = isset($args[3]) ? $args[3] : 'app/model';

            if($table=='all'){
                $result = $this->getDBSchema();
                while($row = $result->fetch()){
                    $model = \Disco\manage\Manager::buildModel($row['table_name']);
                    \Disco\manage\Manager::writeModel($row['table_name'],$model,$templatePath,$outputPath);
                }//while
            }//if
            else {
                $model = \Disco\manage\Manager::buildModel($table);
                \Disco\manage\Manager::writeModel($table,$model,$templatePath,$outputPath);
            }//el

        }//if
        else if($args[0] == 'record'){

            if(!isset($args[1])){
                echo 'You must specify a table to build the record from' . PHP_EOL;
                exit;
            }//if

            $table = $args[1];

            $templatePath = isset($args[2]) ? $args[2] : 'app/config/record.format';
            $outputPath = isset($args[3]) ? $args[3] : 'app/record';

            if($table=='all'){
                $result = $this->getDBSchema();
                while($row = $result->fetch()){
                    $record = \Disco\manage\Manager::buildRecord($row['table_name']);
                    \Disco\manage\Manager::writeRecord($row['table_name'],$record,$templatePath,$outputPath);
                }//while
            }//if
            else {
                $record = \Disco\manage\Manager::buildRecord($table);
                \Disco\manage\Manager::writeRecord($table,$record,$templatePath,$outputPath);
            }//el

        }//elif

    }
public function create($args){

        if($args[0] == 'model'){

            if(!isset($args[1])){
                echo 'You must specify a table to build the model from' . PHP_EOL;
                exit;
            }//if

            $table = $args[1];

            $templatePath = isset($args[2]) ? $args[2] : 'app/config/model.format';
            $outputPath = isset($args[3]) ? $args[3] : 'app/model';

            if($table=='all'){
                $result = $this->getDBSchema();
                while($row = $result->fetch()){
                    $model = \Disco\manage\Manager::buildModel($row['table_name']);
                    \Disco\manage\Manager::writeModel($row['table_name'],$model,$templatePath,$outputPath);
                }//while
            }//if
            else {
                $model = \Disco\manage\Manager::buildModel($table);
                \Disco\manage\Manager::writeModel($table,$model,$templatePath,$outputPath);
            }//el

        }//if
        else if($args[0] == 'record'){

            if(!isset($args[1])){
                echo 'You must specify a table to build the record from' . PHP_EOL;
                exit;
            }//if

            $table = $args[1];

            $templatePath = isset($args[2]) ? $args[2] : 'app/config/record.format';
            $outputPath = isset($args[3]) ? $args[3] : 'app/record';

            if($table=='all'){
                $result = $this->getDBSchema();
                while($row = $result->fetch()){
                    $record = \Disco\manage\Manager::buildRecord($row['table_name']);
                    \Disco\manage\Manager::writeRecord($row['table_name'],$record,$templatePath,$outputPath);
                }//while
            }//if
            else {
                $record = \Disco\manage\Manager::buildRecord($table);
                \Disco\manage\Manager::writeRecord($table,$record,$templatePath,$outputPath);
            }//el

        }//elif

    }
public function create ( $ args ) { if ( $ args [ 0 ] == 'model' ) { if ( ! isset ( $ args [ 1 ] ) ) { echo 'You must specify a table to build the model from' . PHP_EOL ; exit ; } //if $ table = $ args [ 1 ] ; $ templatePath = isset ( $ args [ 2 ] ) ? $ args [ 2 ] : 'app/config/model.format' ; $ outputPath = isset ( $ args [ 3 ] ) ? $ args [ 3 ] : 'app/model' ; if ( $ table == 'all' ) { $ result = $ this -> getDBSchema ( ) ; while ( $ row = $ result -> fetch ( ) ) { $ model = \ Disco \ manage \ Manager :: buildModel ( $ row [ 'table_name' ] ) ; \ Disco \ manage \ Manager :: writeModel ( $ row [ 'table_name' ] , $ model , $ templatePath , $ outputPath ) ; } //while } //if else { $ model = \ Disco \ manage \ Manager :: buildModel ( $ table ) ; \ Disco \ manage \ Manager :: writeModel ( $ table , $ model , $ templatePath , $ outputPath ) ; } //el } //if else if ( $ args [ 0 ] == 'record' ) { if ( ! isset ( $ args [ 1 ] ) ) { echo 'You must specify a table to build the record from' . PHP_EOL ; exit ; } //if $ table = $ args [ 1 ] ; $ templatePath = isset ( $ args [ 2 ] ) ? $ args [ 2 ] : 'app/config/record.format' ; $ outputPath = isset ( $ args [ 3 ] ) ? $ args [ 3 ] : 'app/record' ; if ( $ table == 'all' ) { $ result = $ this -> getDBSchema ( ) ; while ( $ row = $ result -> fetch ( ) ) { $ record = \ Disco \ manage \ Manager :: buildRecord ( $ row [ 'table_name' ] ) ; \ Disco \ manage \ Manager :: writeRecord ( $ row [ 'table_name' ] , $ record , $ templatePath , $ outputPath ) ; } //while } //if else { $ record = \ Disco \ manage \ Manager :: buildRecord ( $ table ) ; \ Disco \ manage \ Manager :: writeRecord ( $ table , $ record , $ templatePath , $ outputPath ) ; } //el } //elif }
Create a model or a record. Use the special keyword `all` in place of a table name to generate records or
models for all tables.

eg: `create model user`
eg: `create model user /app/config/model.format /app/model/`

eg: `create record user`
eg: `create record user /app/config/record.format /app/record/`

@param array $args The arguements.
Create a model or a record . Use the special keyword all in place of a table name to generate records or models for all tables .