Skip to content
Snippets Groups Projects
Commit 57d00792 authored by Jared Hancock's avatar Jared Hancock
Browse files

orm: Call __onload() after refetching new objects

parent 64672f21
No related branches found
No related tags found
No related merge requests found
...@@ -361,6 +361,7 @@ class VerySimpleModel { ...@@ -361,6 +361,7 @@ class VerySimpleModel {
} }
$pk = static::$meta['pk']; $pk = static::$meta['pk'];
$wasnew = $this->__new__;
if ($this->__new__) { if ($this->__new__) {
if (count($pk) == 1) if (count($pk) == 1)
...@@ -368,7 +369,6 @@ class VerySimpleModel { ...@@ -368,7 +369,6 @@ class VerySimpleModel {
$this->ht[$pk[0]] = $ex->insert_id(); $this->ht[$pk[0]] = $ex->insert_id();
$this->__new__ = false; $this->__new__ = false;
Signal::send('model.created', $this); Signal::send('model.created', $this);
$this->__onload();
} }
else { else {
$data = array('dirty' => $this->dirty); $data = array('dirty' => $this->dirty);
...@@ -383,6 +383,8 @@ class VerySimpleModel { ...@@ -383,6 +383,8 @@ class VerySimpleModel {
$self = static::lookup($this->get('pk')); $self = static::lookup($this->get('pk'));
$this->ht = $self->ht; $this->ht = $self->ht;
} }
if ($wasnew)
$this->__onload();
$this->dirty = array(); $this->dirty = array();
return $this->get($pk[0]); return $this->get($pk[0]);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment