dblayer : allow to define external verifyOne/verifyAll functions instead of using internal ones (or the extended ones)

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2909 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2016-07-19 10:00:07 +00:00
parent e15945f4df
commit bc0bd0d1e7

View File

@@ -60,6 +60,9 @@ class dblayer
/** Titles */
public $titles = array ();
public $verifyOne = array ("dblayer", "verifyOne");
public $verifyAll = array ("dblayer", "verifyAll");
/** The verify unitary stack
@param string $field The name of the field to test
@param string $val The value of the field to test */
@@ -295,7 +298,7 @@ class dblayer
continue;
// Verify the fields, if $verify is defined, before doing insertion
$verify = $this->verifyOne ($key, $data[$key]);
$verify = call_user_func ($this->verifyOne, $key, $data[$key]);
if (is_array ($verify) && count ($verify))
{
$errors[$key] = array ($verify[0], $verify[1]);
@@ -390,7 +393,7 @@ class dblayer
if ($this->debug) echo " verify inconsistency\n";
// Check for inconsistency
$verify = $this->verifyAll ($data);
$verify = call_user_func ($this->verifyAll, $data);
if (count ($verify))
return $verify;