From: Raphaƫl Gertz <git@rapsys.eu>
Date: Sat, 28 Aug 2021 03:46:53 +0000 (+0200)
Subject: Remove dance link on session
X-Git-Tag: 0.2.0~63
X-Git-Url: https://git.rapsys.eu/airbundle/commitdiff_plain/6d87d1dbad7e333cd41b57c641515ae05a7653f3

Remove dance link on session
Add dance link on application
Fix variable name in preUpdate
---

diff --git a/Entity/Application.php b/Entity/Application.php
index b54b1e2..48e6992 100644
--- a/Entity/Application.php
+++ b/Entity/Application.php
@@ -22,6 +22,11 @@ class Application {
 	 */
 	private $id;
 
+	/**
+	 * @var Dance
+	 */
+	private $dance;
+
 	/**
 	 * @var float
 	 */
@@ -69,6 +74,28 @@ class Application {
 		return $this->id;
 	}
 
+	/**
+	 * Set dance
+	 *
+	 * @param Dance $dance
+	 *
+	 * @return Session
+	 */
+	public function setDance(Dance $dance): Session {
+		$this->dance = $dance;
+
+		return $this;
+	}
+
+	/**
+	 * Get dance
+	 *
+	 * @return Dance
+	 */
+	public function getDance(): Dance {
+		return $this->dance;
+	}
+
 	/**
 	 * Set score
 	 *
@@ -206,9 +233,9 @@ class Application {
 	 */
 	public function preUpdate(PreUpdateEventArgs $eventArgs) {
 		//Check that we have an application instance
-		if (($user = $eventArgs->getEntity()) instanceof Application) {
+		if (($application = $eventArgs->getEntity()) instanceof Application) {
 			//Set updated value
-			$user->setUpdated(new \DateTime('now'));
+			$application->setUpdated(new \DateTime('now'));
 		}
 	}
 }
diff --git a/Entity/Location.php b/Entity/Location.php
index 1fdca93..6e66cea 100644
--- a/Entity/Location.php
+++ b/Entity/Location.php
@@ -427,9 +427,9 @@ class Location {
 	 */
 	public function preUpdate(PreUpdateEventArgs $eventArgs) {
 		//Check that we have a location instance
-		if (($user = $eventArgs->getEntity()) instanceof Location) {
+		if (($location = $eventArgs->getEntity()) instanceof Location) {
 			//Set updated value
-			$user->setUpdated(new \DateTime('now'));
+			$location->setUpdated(new \DateTime('now'));
 		}
 	}
 
diff --git a/Entity/Session.php b/Entity/Session.php
index f5f0ef5..fb0b8f3 100644
--- a/Entity/Session.php
+++ b/Entity/Session.php
@@ -113,11 +113,6 @@ class Session {
 	 */
 	private $application;
 
-	/**
-	 * @var Dance
-	 */
-	private $dance;
-
 	/**
 	 * @var Location
 	 */
@@ -579,28 +574,6 @@ class Session {
 		return $this->applications;
 	}
 
-	/**
-	 * Set dance
-	 *
-	 * @param Dance $dance
-	 *
-	 * @return Session
-	 */
-	public function setDance(Dance $dance): Session {
-		$this->dance = $dance;
-
-		return $this;
-	}
-
-	/**
-	 * Get dance
-	 *
-	 * @return Dance
-	 */
-	public function getDance(): Dance {
-		return $this->dance;
-	}
-
 	/**
 	 * Set location
 	 *
@@ -672,9 +645,9 @@ class Session {
 	 */
 	public function preUpdate(PreUpdateEventArgs $eventArgs) {
 		//Check that we have a session instance
-		if (($user = $eventArgs->getEntity()) instanceof Session) {
+		if (($session = $eventArgs->getEntity()) instanceof Session) {
 			//Set updated value
-			$user->setUpdated(new \DateTime('now'));
+			$session->setUpdated(new \DateTime('now'));
 		}
 	}
 
diff --git a/Entity/Slot.php b/Entity/Slot.php
index 10e5b3d..c5fcd86 100644
--- a/Entity/Slot.php
+++ b/Entity/Slot.php
@@ -161,9 +161,9 @@ class Slot {
 	 */
 	public function preUpdate(PreUpdateEventArgs $eventArgs) {
 		//Check that we have a slot instance
-		if (($user = $eventArgs->getEntity()) instanceof Slot) {
+		if (($slot = $eventArgs->getEntity()) instanceof Slot) {
 			//Set updated value
-			$user->setUpdated(new \DateTime('now'));
+			$slot->setUpdated(new \DateTime('now'));
 		}
 	}