protected function beforeUpdate() { parent::beforeUpdate(); $this->timeEdited = time(); if ($this->commentsOpenFor !== null) { if ($this->commentsOpenFor !== 0) { $this->commentsCloseDate = $this->timePosted + 60*60*24*$this->commentsOpenFor; } else { $this->commentsCloseDate = null; } } }