Skip to content

Commit

Permalink
id of newly created record's primary key is set to $this->data before…
Browse files Browse the repository at this point in the history
… afterSave was called.
  • Loading branch information
basuke authored and Yosuke Basuke Suzuki committed Sep 7, 2011
1 parent 12a038e commit 0b1bd27
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cake/libs/model/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1572,6 +1572,9 @@ public function save($data = null, $validate = true, $fieldList = array()) {
if ($success && $count > 0) {
if (!empty($this->data)) {
$success = $this->data;
if ($created) {
$this->data[$this->alias][$this->primaryKey] = $this->id;
}
}
if ($options['callbacks'] === true || $options['callbacks'] === 'after') {
$this->Behaviors->trigger('afterSave', array(&$this, $created, $options));
Expand Down

0 comments on commit 0b1bd27

Please sign in to comment.