DbObject: do not insert id=NULL, fails on pgsql

This commit is contained in:
Thomas Gelf 2015-06-23 13:05:02 +02:00
parent bea63149c6
commit 6c8213f4db

View File

@ -550,7 +550,11 @@ abstract class DbObject
*/ */
protected function insertIntoDb() protected function insertIntoDb()
{ {
return $this->db->insert($this->table, $this->getProperties()); $properties = $this->getProperties();
if ($this->autoincKeyName !== null) {
unset($properties[$this->autoincKeyName]);
}
return $this->db->insert($this->table, $properties);
} }
/** /**