* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // php fstudio modulo:acciones "Julian Lasso" ingeniero.julianlasso@gmail.com module:prueba controller:prueba use fsCamelCasePlugin\fsCamelCase as camcelCase; try { $cc = new camcelCase(); $autor = $argv[2]; $email = $argv[3]; $module = $cc->camelCase(explode(':', $argv[4])[1]); $moduleName = $cc->camelCase(explode(':', $argv[isset($argv[5]) === true ? 5 : 4])[1]) . 'Controller'; $year = date("Y"); $dir = $config->getPath() . 'controller/' . $module; $file = $dir . '/' . $moduleName . '.class.php'; if (is_file($file) === true) { throw new Exception("\n+--------------------------------------------------------+\n" . "| ERROR!!! |\n" . "+--------------------------------------------------------+\n" . "| El modulo y acción que deseas crear ya está creada |\n" . "+--------------------------------------------------------+\n" . "\n\n"); } elseif (is_dir($dir) === false) { mkdir($dir); } $template = <<<TEMPLATE <?php
* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // php fstudio modulo:accion "Julian Lasso" ingeniero.julianlasso@gmail.com modulo:prueba accion:index use fsCamelCasePlugin\fsCamelCase as camcelCase; try { $cc = new camcelCase(); $autor = $argv[2]; $email = $argv[3]; $module = $cc->camelCase(explode(':', $argv[4])[1]); $action = $cc->camelCase(explode(':', $argv[5])[1]) . 'Action'; $year = date("Y"); $dir = $config->getPath() . 'controller/' . $module; $file = $dir . '/' . $action . '.class.php'; if (is_file($file) === true) { throw new Exception("\n+--------------------------------------------------------+\n" . "| ERROR!!! |\n" . "+--------------------------------------------------------+\n" . "| La acción que deseas crear ya está creada |\n" . "+--------------------------------------------------------+\n" . "\n\n"); } elseif (is_dir($dir) === false) { mkdir($dir); } $template = <<<TEMPLATE <?php
* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // php fstudio modelo:generar use fsCamelCasePlugin\fsCamelCase as camelCase; use Symfony\Component\Yaml\Parser; if (is_file('config/model.yml') === false) { throw new Exception("El archivo model.yml no existe en la carpeta config/\n"); } $yaml = new Parser(); $cc = new camelCase(); $model = $yaml->parse(file_get_contents('config/model.yml')); if (is_dir('model') === false) { mkdir('model'); } if (is_dir('model/base') === false) { mkdir('model/base'); } foreach ($model['schema'] as $table => $attributes) { $nameTable = " const _TABLE = '{$table}';\n"; $tableClass = isset($attributes['name']) === true ? $attributes['name'] : $table; $nameFileBase = $cc->camelCase($tableClass . 'BaseTable'); $nameFileTable = $cc->camelCase($tableClass . 'Table'); $constructHead = "\n public function __construct(config \$config, "; $constructHeadItems = ''; $constructBody = " \$this->config = \$config;\n";