From 61dbbf797da98569a9436f9e8604d363b7b0522c Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 30 Dec 2022 02:23:07 -0500 Subject: [PATCH] Updated mocks go templates. --- src/mockup/go_text_templates/ctrl.txt | 2 +- src/mockup/go_text_templates/inputs.txt | 12 ++++++------ src/mockup/go_text_templates/logic.txt | 4 ++-- src/mockup/go_text_templates/models.txt | 12 ++++++------ src/mockup/go_text_templates/outputs.txt | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/mockup/go_text_templates/ctrl.txt b/src/mockup/go_text_templates/ctrl.txt index 7c959aa..caf332f 100644 --- a/src/mockup/go_text_templates/ctrl.txt +++ b/src/mockup/go_text_templates/ctrl.txt @@ -4,7 +4,7 @@ declare(strict_types=1); namespace prj\{{.Root}}\controllers\{{.Subfolder}}; -use \bs_tts\use_iol as IOL; +use \tts\use_iol as IOL; class {{.File}}_ctrl { public $page_output; // Required Public Property Called page_output for View to work! diff --git a/src/mockup/go_text_templates/inputs.txt b/src/mockup/go_text_templates/inputs.txt index 6ffc431..db1233b 100644 --- a/src/mockup/go_text_templates/inputs.txt +++ b/src/mockup/go_text_templates/inputs.txt @@ -4,12 +4,12 @@ declare(strict_types=1); namespace prj\{{.Root}}\inputs\{{.Subfolder}}; -use \tts\enum\INPUTS; -use \tts\enum\FIELD_FILTER; -use \tts\enum\HTML_FLAG; -use \tts\enum\DB_FILTER; +use \tts\INPUTS; +use \tts\FIELD_FILTER; +use \tts\HTML_FLAG; +use \tts\DB_FILTER; -use \bs_tts\use_io as IO; +use \tts\use_io as IO; class {{.File}}_in { @@ -22,7 +22,7 @@ class {{.File}}_in { */ public static function {{.Method}}(): array { - \bs_tts\safer_io::init_json(); // Staticly set JSON data if any + \tts\safer_io::init_json(); // Staticly set JSON data if any $required_post_string_field = new IO(); $required_post_string_field->input_type = INPUTS::post; diff --git a/src/mockup/go_text_templates/logic.txt b/src/mockup/go_text_templates/logic.txt index 8f0a690..e8e8e2c 100644 --- a/src/mockup/go_text_templates/logic.txt +++ b/src/mockup/go_text_templates/logic.txt @@ -4,12 +4,12 @@ declare(strict_types=1); namespace prj\{{.Root}}\logic\{{.Subfolder}}; -use \bs_tts\safer_io as SafeIO; +use \tts\safer_io as SafeIO; class {{.File}}_logic { public static function {{.Method}}(array & $input): void { - $model = new \prj\{{.Root}}\models\{{.Subfolder}}\{{.File}}_model(\main_tts\registry::get('db')); + $model = new \prj\{{.Root}}\models\{{.Subfolder}}\{{.File}}_model(\tts\registry::get('db')); $submitted = true; foreach(SafeIO::logic_sanitize($input) as $data) { diff --git a/src/mockup/go_text_templates/models.txt b/src/mockup/go_text_templates/models.txt index 26ae5ab..94e5ea1 100644 --- a/src/mockup/go_text_templates/models.txt +++ b/src/mockup/go_text_templates/models.txt @@ -4,7 +4,7 @@ declare(strict_types=1); namespace prj\{{.Root}}\models\{{.Subfolder}}; -class {{.File}}_model extends \tts\database\model { +class {{.File}}_model extends \tts\model { protected $pdo; protected $table = "test_names"; @@ -35,9 +35,9 @@ class {{.File}}_model extends \tts\database\model { } public function populate($rows): void { - $dummy = new \tts\database\dummy_data($this->pdo); - $data = [ 'first_name' => \tts\arrays\mocking\rnd_names::get_first_names(), - 'last_name' => \tts\arrays\mocking\rnd_names::get_last_names(), + $dummy = new \tts\dummy_data($this->pdo); + $data = [ 'first_name' => \tts\rnd_names::get_first_names(), + 'last_name' => \tts\rnd_names::get_last_names(), ]; $dummy->add_dummy_data($this->table, $rows, $data); } @@ -50,7 +50,7 @@ class {{.File}}_model extends \tts\database\model { try { $status = $this->save(); } catch (\PDOException $e) { - echo \tts\exceptions\DB_Exception::customMessage($e, "Unable to save changes!"); + echo \tts\DB_Exception::customMessage($e, "Unable to save changes!"); } if ($status === self::successful_save) { return true; // It saved @@ -67,7 +67,7 @@ class {{.File}}_model extends \tts\database\model { $result = $this->pdo->query($sql); return self::pdo_fetch_lazy($result); } catch (\PDOException $e) { - echo \tts\exceptions\DB_Exception::customMessage($e); + echo \tts\DB_Exception::customMessage($e); } } } diff --git a/src/mockup/go_text_templates/outputs.txt b/src/mockup/go_text_templates/outputs.txt index 45fed2b..43b24f4 100644 --- a/src/mockup/go_text_templates/outputs.txt +++ b/src/mockup/go_text_templates/outputs.txt @@ -4,7 +4,7 @@ declare(strict_types=1); namespace prj\{{.Root}}\outputs\{{.Subfolder}}; -use \bs_tts\safer_io as SafeIO; +use \tts\safer_io as SafeIO; class {{.File}}_out { @@ -21,7 +21,7 @@ class {{.File}}_out { $key = $html['name'] ?? ""; $html_output[$key] = $html['html']; - if (\bs_tts\common::get_count($html['errors'])) { + if (\tts\common::get_count($html['errors'])) { $errors[$key] = $html['errors'][$key]; } } @@ -30,7 +30,7 @@ class {{.File}}_out { $first_name = $html_output['first_name'] ?? "Unknown"; $last_name = $html_output['last_name'] ?? "Unknown"; - $ret['main'] = (\bs_tts\common::get_count($errors)) ? "" : "Hello, {$first_name} {$last_name}." . PHP_EOL; + $ret['main'] = (\tts\common::get_count($errors)) ? "" : "Hello, {$first_name} {$last_name}." . PHP_EOL; $ret['errors'] = $errors; } else { $ret['main'] = "Welcome";