public function onBeforePublish()
    {
        /**
         * @var DBDatetime $publishDate
         */
        $publishDate = $this->dbObject('PublishDate');
        if (!$publishDate->getValue()) {
            $this->PublishDate = DBDatetime::now()->getValue();
            $this->write();
        }

        $this->Summary = trim($this->Summary);

        $this->extend('onBeforePublish');
    }
public function onBeforePublish()
    {
        /**
         * @var DBDatetime $publishDate
         */
        $publishDate = $this->dbObject('PublishDate');
        if (!$publishDate->getValue()) {
            $this->PublishDate = DBDatetime::now()->getValue();
            $this->write();
        }

        $this->Summary = trim($this->Summary);

        $this->extend('onBeforePublish');
    }
public function onBeforePublish ( ) { /**
         * @var DBDatetime $publishDate
         */ $ publishDate = $ this -> dbObject ( 'PublishDate' ) ; if ( ! $ publishDate -> getValue ( ) ) { $ this -> PublishDate = DBDatetime :: now ( ) -> getValue ( ) ; $ this -> write ( ) ; } $ this -> Summary = trim ( $ this -> Summary ) ; $ this -> extend ( 'onBeforePublish' ) ; }
Update the PublishDate to now if the BlogPost would otherwise be published without a date.
Update the PublishDate to now if the BlogPost would otherwise be published without a date .