DbObject: new method getKeyParams()

This commit is contained in:
Thomas Gelf 2015-10-15 17:48:29 +02:00
parent 12f62fe30c
commit 7f9d1750c5
1 changed files with 15 additions and 0 deletions

View File

@ -426,6 +426,21 @@ abstract class DbObject
return $this->autoincKeyName;
}
public function getKeyParams()
{
$params = array();;
$key = $this->getKeyName();
if (is_array($key)) {
foreach ($key as $k) {
$params[$k] = $this->get($k);
}
} else {
$params[$key] = $this->get($this->keyName);
}
return $params;
}
/**
* Return the unique identifier
*