Skip to content

Instantly share code, notes, and snippets.

Created February 23, 2013 12:12
Show Gist options
  • Save anonymous/5019559 to your computer and use it in GitHub Desktop.
Save anonymous/5019559 to your computer and use it in GitHub Desktop.
checking multiple fields for uniqueness
function checkMultipleUnique ($data, $fields) {
if (!is_array($fields)) {
$fields = array($fields);
}
foreach($fields as $key) {
$tmp[$key] = $this->data[$this->name][$key];
}
if (isset($this->data[$this->name][$this->primaryKey])) {
$tmp[$this->primaryKey] = "<>".$this->data[$this->name][$this->primaryKey];
}
return $this->isUnique($tmp, false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment