dblayeroo: add return $this to setForeignObj
dblayeroo: manage correctely the foreign keys git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3558 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -1313,6 +1313,7 @@ class dblayeroo
|
||||
$this->DBException (
|
||||
"Invalid object provided to setForeignObj (no table defined)");
|
||||
$this->setForeignObj[$object->tableprefix.$object->table] = $object;
|
||||
return $this;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -2262,9 +2263,10 @@ class dblayeroo
|
||||
// - If foreign keys, check if the value is set in the constraint
|
||||
foreach ($this->foreign as $field=>$params)
|
||||
{
|
||||
if (! array_key_exists ($field, $this->setValues))
|
||||
$errors[$field] = dgettext ("domframework",
|
||||
"The field '%s' must be test on foreign, but is not provided");
|
||||
if (! array_key_exists ($field, $values))
|
||||
$errors[$field] = sprintf (dgettext ("domframework",
|
||||
"The field '%s' must be test on foreign, but is not provided"),
|
||||
$field);
|
||||
if (! array_key_exists ($params[0], $this->setForeignObj))
|
||||
$this->DBException (dgettext ("domframework",
|
||||
"No foreign object configured to test the foreign key"));
|
||||
@@ -2275,7 +2277,7 @@ class dblayeroo
|
||||
$objTmp->clearRequest ();
|
||||
$objTmp->Select ();
|
||||
$objTmp->displayAdd ($objTmp->primary);
|
||||
$objTmp->whereAdd ($params[1], "=", $this->setValues[$field]);
|
||||
$objTmp->whereAdd ($params[1], "=", $values[$field]);
|
||||
if (count ($objTmp->execute ()) === 0)
|
||||
$errors[$field] = sprintf (dgettext ("domframework",
|
||||
"The value of the foreign key '%s' doesn't exists in foreign table"),
|
||||
|
||||
Reference in New Issue
Block a user