|
@@ 106-119 (lines=14) @@
|
| 103 |
|
// generate table |
| 104 |
|
$tableFile = $this->getApplication()->getModelPath($modelName) . DS . 'Table.php'; |
| 105 |
|
|
| 106 |
|
if (file_exists($tableFile)) { |
| 107 |
|
$this->comment("Table file <info>$modelName/Table.php</info> already exists"); |
| 108 |
|
} else { |
| 109 |
|
$template = $this->getTemplate('TableTemplate'); |
| 110 |
|
$template->setFilePath($tableFile); |
| 111 |
|
$template->setTemplateData([ |
| 112 |
|
'model' => $modelName, |
| 113 |
|
'table' => $tableName, |
| 114 |
|
'primaryKey' => $this->getPrimaryKey($tableName) |
| 115 |
|
]); |
| 116 |
|
|
| 117 |
|
$generator = new Generator\Generator($template); |
| 118 |
|
$generator->make(); |
| 119 |
|
} |
| 120 |
|
|
| 121 |
|
// generate row |
| 122 |
|
$rowFile = $this->getApplication()->getModelPath($modelName) . DS . 'Row.php'; |
|
@@ 124-139 (lines=16) @@
|
| 121 |
|
// generate row |
| 122 |
|
$rowFile = $this->getApplication()->getModelPath($modelName) . DS . 'Row.php'; |
| 123 |
|
|
| 124 |
|
if (file_exists($rowFile)) { |
| 125 |
|
$this->comment("Row file <info>$modelName/Row.php</info> already exists"); |
| 126 |
|
} else { |
| 127 |
|
$template = $this->getTemplate('RowTemplate'); |
| 128 |
|
$template->setFilePath($rowFile); |
| 129 |
|
$template->setTemplateData( |
| 130 |
|
[ |
| 131 |
|
'model' => $modelName, |
| 132 |
|
'table' => $tableName, |
| 133 |
|
'columns' => $this->getColumns($tableName) |
| 134 |
|
] |
| 135 |
|
); |
| 136 |
|
|
| 137 |
|
$generator = new Generator\Generator($template); |
| 138 |
|
$generator->make(); |
| 139 |
|
} |
| 140 |
|
} |
| 141 |
|
|
| 142 |
|
/** |