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