From f0ed7af138b95f31354f8d5a37cb4cd27b902a75 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Sat, 28 Aug 2021 09:55:54 +0200 Subject: [PATCH] Add defaults Fix inproper strict return --- Entity/Application.php | 9 +++++++-- Entity/Dance.php | 3 +++ Entity/Location.php | 3 +++ Entity/Session.php | 5 ++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Entity/Application.php b/Entity/Application.php index 48e6992..5d31203 100644 --- a/Entity/Application.php +++ b/Entity/Application.php @@ -61,6 +61,11 @@ class Application { * Constructor */ public function __construct() { + //Set defaults + $this->score = null; + $this->canceled = null; + $this->created = new \DateTime('now'); + $this->updated = new \DateTime('now'); $this->session = null; $this->user = null; } @@ -79,9 +84,9 @@ class Application { * * @param Dance $dance * - * @return Session + * @return Application */ - public function setDance(Dance $dance): Session { + public function setDance(Dance $dance): Application { $this->dance = $dance; return $this; diff --git a/Entity/Dance.php b/Entity/Dance.php index fa07ba9..e3779da 100644 --- a/Entity/Dance.php +++ b/Entity/Dance.php @@ -52,6 +52,9 @@ class Dance { * Constructor */ public function __construct() { + //Set defaults + $this->created = new \DateTime('now'); + $this->updated = new \DateTime('now'); $this->applications = new ArrayCollection(); $this->users = new ArrayCollection(); } diff --git a/Entity/Location.php b/Entity/Location.php index 4af1280..57af698 100644 --- a/Entity/Location.php +++ b/Entity/Location.php @@ -87,6 +87,9 @@ class Location { * Constructor */ public function __construct() { + //Set defaults + $this->created = new \DateTime('now'); + $this->updated = new \DateTime('now'); $this->sessions = new ArrayCollection(); $this->snippets = new ArrayCollection(); $this->users = new ArrayCollection(); diff --git a/Entity/Session.php b/Entity/Session.php index fb0b8f3..084580e 100644 --- a/Entity/Session.php +++ b/Entity/Session.php @@ -132,10 +132,12 @@ class Session { * Constructor */ public function __construct() { + //Set defaults $this->begin = null; $this->start = null; $this->length = null; $this->stop = null; + $this->premium = null; $this->rainfall = null; $this->rainrisk = null; $this->realfeel = null; @@ -145,7 +147,8 @@ class Session { $this->temperaturemin = null; $this->temperaturemax = null; $this->locked = null; - $this->premium = null; + $this->created = new \DateTime('now'); + $this->updated = new \DateTime('now'); $this->applications = new ArrayCollection(); } -- 2.41.1