Skip to content

Commit 9013d6e

Browse files
committed
dbObject: add primary key after insert() to the model
1 parent fb611b6 commit 9013d6e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

dbObject.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,12 @@ public function update ($data = null) {
268268
* @return mixed insert id or false in case of failure
269269
*/
270270
public function save ($data = null) {
271-
if ($this->isNew)
272-
return $this->insert();
271+
if ($this->isNew) {
272+
$id = $this->insert();
273+
if (isset ($this->primaryKey))
274+
$this->data[$this->primaryKey] = $id;
275+
return $id;
276+
}
273277
return $this->update($data);
274278
}
275279

0 commit comments

Comments
 (0)