mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
BlogPost: onBeforePublish: Removed owner + added 'dbObject'
This commit is contained in:
parent
65301b91dc
commit
c7541e2d17
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user