dblayeroo: allow the primary key to be the unique key (and the unique is not defined)
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3564 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -2184,10 +2184,11 @@ class dblayeroo
|
|||||||
// - Check the unique entries (if defined)
|
// - Check the unique entries (if defined)
|
||||||
// The primary key is always unique : add it if not set by the user
|
// The primary key is always unique : add it if not set by the user
|
||||||
$this->debugLog (" verify the unique constraint");
|
$this->debugLog (" verify the unique constraint");
|
||||||
if (! in_array ($this->primary, $this->unique))
|
|
||||||
$uniques = array_merge (array ($this->primary), $this->unique);
|
|
||||||
else
|
|
||||||
$uniques = $this->unique;
|
$uniques = $this->unique;
|
||||||
|
if (! is_array ($uniques))
|
||||||
|
$uniques = array ();
|
||||||
|
if (! in_array ($this->primary, $uniques))
|
||||||
|
$uniques = array_merge (array ($this->primary), $uniques);
|
||||||
$setValues = $values;
|
$setValues = $values;
|
||||||
if (! array_key_exists ($this->primary, $setValues))
|
if (! array_key_exists ($this->primary, $setValues))
|
||||||
$setValues[$this->primary] = null;
|
$setValues[$this->primary] = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user