BlogPost: onBeforePublish: Removed owner + added 'dbObject'

This commit is contained in:
James Cocker 2014-06-13 11:45:28 +01:00
parent 65301b91dc
commit c7541e2d17

View File

@ -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. * 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() { public function onBeforePublish() {
if ($this->owner->obj('PublishDate')->InPast() && !$this->owner->isPublished()) { if ($this->dbObject('PublishDate')->InPast() && !$this->isPublished()) {
$this->owner->setCastedField("PublishDate", time()); $this->setCastedField("PublishDate", time());
$this->owner->write(); $this->write();
} }
} }