- $this->setTimestamp();
- $this->setMsg();
- }
-
- /**
- * Set the notification as seen
- *
- * @param bool $seen true, if seen
- *
- * @return bool True, if the seen state could be saved
- */
- public function setSeen(bool $seen = true)
- {
- $this->seen = $seen;
- try {
- return $this->repo->update($this);
- } catch (Exception $e) {
- $this->logger->warning('Update failed.', ['$this' => $this, 'exception' => $e]);
- return false;
- }
- }
-
- /**
- * Set some extra properties to the notification from db:
- * - timestamp as int in default TZ
- * - date_rel : relative date string
- */
- private function setTimestamp()
- {
- try {
- $this->timestamp = strtotime(DateTimeFormat::local($this->date));
- } catch (Exception $e) {
- }
- $this->dateRel = Temporal::getRelativeDate($this->date);