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 (
|
$this->DBException (
|
||||||
"Invalid object provided to setForeignObj (no table defined)");
|
"Invalid object provided to setForeignObj (no table defined)");
|
||||||
$this->setForeignObj[$object->tableprefix.$object->table] = $object;
|
$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
|
// - If foreign keys, check if the value is set in the constraint
|
||||||
foreach ($this->foreign as $field=>$params)
|
foreach ($this->foreign as $field=>$params)
|
||||||
{
|
{
|
||||||
if (! array_key_exists ($field, $this->setValues))
|
if (! array_key_exists ($field, $values))
|
||||||
$errors[$field] = dgettext ("domframework",
|
$errors[$field] = sprintf (dgettext ("domframework",
|
||||||
"The field '%s' must be test on foreign, but is not provided");
|
"The field '%s' must be test on foreign, but is not provided"),
|
||||||
|
$field);
|
||||||
if (! array_key_exists ($params[0], $this->setForeignObj))
|
if (! array_key_exists ($params[0], $this->setForeignObj))
|
||||||
$this->DBException (dgettext ("domframework",
|
$this->DBException (dgettext ("domframework",
|
||||||
"No foreign object configured to test the foreign key"));
|
"No foreign object configured to test the foreign key"));
|
||||||
@@ -2275,7 +2277,7 @@ class dblayeroo
|
|||||||
$objTmp->clearRequest ();
|
$objTmp->clearRequest ();
|
||||||
$objTmp->Select ();
|
$objTmp->Select ();
|
||||||
$objTmp->displayAdd ($objTmp->primary);
|
$objTmp->displayAdd ($objTmp->primary);
|
||||||
$objTmp->whereAdd ($params[1], "=", $this->setValues[$field]);
|
$objTmp->whereAdd ($params[1], "=", $values[$field]);
|
||||||
if (count ($objTmp->execute ()) === 0)
|
if (count ($objTmp->execute ()) === 0)
|
||||||
$errors[$field] = sprintf (dgettext ("domframework",
|
$errors[$field] = sprintf (dgettext ("domframework",
|
||||||
"The value of the foreign key '%s' doesn't exists in foreign table"),
|
"The value of the foreign key '%s' doesn't exists in foreign table"),
|
||||||
|
|||||||
Reference in New Issue
Block a user