Powerful and easy to use cms to build websites, blogs or ecommerce stores.
HTML backendblogblog-engineblog-platformbloggingcmscontent-managementcontent-management-systemecommerceecommerce-platformno-codepage-builderphpphp-cmsphp7php8self-hostedshopping-cartweb-applicationwebsite-builder
Include validate method in sqlP generated models
givanz9cc9ddd37d95
diff --git a/system/sqlp/mysqli.php b/system/sqlp/mysqli.phpindex 185bdda..b9a2652 100755--- a/system/sqlp/mysqli.php+++ b/system/sqlp/mysqli.php@@ -11,9 +11,28 @@ class %name%SQL {private $db;+ protected $filters = %filters%;++ protected $paramTypes = %paramTypes%;+public function __construct(){$this->db = Db::getInstance();}++ public function validate($data, $method, $table = '', $ignoreMissing = false) {+ $params = $this->paramTypes[$method] ?? [];+ if (!$params) {+ return false;+ }++ foreach ($params as $name => $type) {+ if (isset($this->filters[$name])) {+ $params[$name] = $this->filters[$name];+ }+ }++ return $this->db->validate($data, $params, $table, $ignoreMissing);+ }%methods_start%diff --git a/system/sqlp/pgsql.php b/system/sqlp/pgsql.phpindex d83a09a..1c4f84a 100755--- a/system/sqlp/pgsql.php+++ b/system/sqlp/pgsql.php@@ -10,11 +10,30 @@ use \Vvveb\System\Db;class %name%SQL {private $db;++ protected $filters = %filters%;++ protected $paramTypes = %paramTypes%;public function __construct(){$this->db = Db::getInstance();}+ public function validate($data, $method, $table = '', $ignoreMissing = false) {+ $params = $this->paramTypes[$method] ?? [];+ if (!$params) {+ return false;+ }++ foreach ($params as $name => $type) {+ if (isset($this->filters[$name])) {+ $params[$name] = $this->filters[$name];+ }+ }++ return $this->db->validate($data, $params, $table, $ignoreMissing);+ }+%methods_start%%methodMultipleTemplate_start%diff --git a/system/sqlp/sqlite.php b/system/sqlp/sqlite.phpindex e5b0bb7..8aec866 100755--- a/system/sqlp/sqlite.php+++ b/system/sqlp/sqlite.php@@ -11,10 +11,29 @@ class %name%SQL {private $db;+ protected $filters = %filters%;++ protected $paramTypes = %paramTypes%;+public function __construct(){$this->db = Db::getInstance();}+ public function validate($data, $method, $table = '', $ignoreMissing = false) {+ $params = $this->paramTypes[$method] ?? [];+ if (!$params) {+ return false;+ }++ foreach ($params as $name => $type) {+ if (isset($this->filters[$name])) {+ $params[$name] = $this->filters[$name];+ }+ }++ return $this->db->validate($data, $params, $table, $ignoreMissing);+ }+%methods_start%%methodMultipleTemplate_start%