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
1 changed files with 3 additions and 3 deletions

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.
**/
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();
}
}