diff --git a/model/BlogPost.php b/model/BlogPost.php index bed684f..3328324 100755 --- a/model/BlogPost.php +++ b/model/BlogPost.php @@ -110,9 +110,9 @@ class BlogPost extends Page { * Update the PublishDate to now, if being published for the first time, and the date hasn't been set to the future. **/ public function onBeforePublish() { - if ($this->owner->obj('PublishDate')->InPast() && !$this->owner->isPublished()) { - $this->owner->setCastedField("PublishDate", time()); - $this->owner->write(); + if ($this->dbObject('PublishDate')->InPast() && !$this->isPublished()) { + $this->setCastedField("PublishDate", time()); + $this->write(); } }