X-Git-Url: https://git.rapsys.eu/airbundle/blobdiff_plain/8bda7e198de0ed76268be5c51b24ed9eeb6af54b..bbee1a26cc393c335f14a40d78a07be18191bbf8:/Entity/Application.php diff --git a/Entity/Application.php b/Entity/Application.php index af4d3a9..48e6992 100644 --- a/Entity/Application.php +++ b/Entity/Application.php @@ -1,7 +1,18 @@ - + * + * for the full copyright and license information, please view the license + * file that was distributed with this source code. + */ namespace Rapsys\AirBundle\Entity; +use Doctrine\ORM\Event\PreUpdateEventArgs; + /** * Application */ @@ -11,6 +22,11 @@ class Application { */ private $id; + /** + * @var Dance + */ + private $dance; + /** * @var float */ @@ -41,15 +57,45 @@ class Application { */ private $user; + /** + * Constructor + */ + public function __construct() { + $this->session = null; + $this->user = null; + } + /** * Get id * * @return integer */ - public function getId() { + public function getId(): int { 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 * @@ -57,7 +103,7 @@ class Application { * * @return Application */ - public function setScore($score) { + public function setScore(?float $score): Application { $this->score = $score; return $this; @@ -68,7 +114,7 @@ class Application { * * @return float */ - public function getScore() { + public function getScore(): ?float { return $this->score; } @@ -79,7 +125,7 @@ class Application { * * @return Application */ - public function setCanceled($canceled) { + public function setCanceled(?\DateTime $canceled): Application { $this->canceled = $canceled; return $this; @@ -90,7 +136,7 @@ class Application { * * @return \DateTime */ - public function getCanceled() { + public function getCanceled(): ?\DateTime { return $this->canceled; } @@ -101,7 +147,7 @@ class Application { * * @return Application */ - public function setCreated($created) { + public function setCreated(\DateTime $created): Application { $this->created = $created; return $this; @@ -112,7 +158,7 @@ class Application { * * @return \DateTime */ - public function getCreated() { + public function getCreated(): \DateTime { return $this->created; } @@ -123,7 +169,7 @@ class Application { * * @return Application */ - public function setUpdated($updated) { + public function setUpdated(\DateTime $updated): Application { $this->updated = $updated; return $this; @@ -134,18 +180,18 @@ class Application { * * @return \DateTime */ - public function getUpdated() { + public function getUpdated(): \DateTime { return $this->updated; } /** * Set session * - * @param \Rapsys\AirBundle\Entity\Session $session + * @param Session $session * * @return Application */ - public function setSession(\Rapsys\AirBundle\Entity\Session $session = null) { + public function setSession(Session $session): Application { $this->session = $session; return $this; @@ -154,20 +200,20 @@ class Application { /** * Get session * - * @return \Rapsys\AirBundle\Entity\Session + * @return Session */ - public function getSession() { + public function getSession(): Session { return $this->session; } /** * Set user * - * @param \Rapsys\AirBundle\Entity\User $user + * @param User $user * * @return Application */ - public function setUser(\Rapsys\AirBundle\Entity\User $user = null) { + public function setUser(User $user): Application { $this->user = $user; return $this; @@ -176,9 +222,20 @@ class Application { /** * Get user * - * @return \Rapsys\AirBundle\Entity\User + * @return User */ - public function getUser() { + public function getUser(): User { return $this->user; } + + /** + * {@inheritdoc} + */ + public function preUpdate(PreUpdateEventArgs $eventArgs) { + //Check that we have an application instance + if (($application = $eventArgs->getEntity()) instanceof Application) { + //Set updated value + $application->setUpdated(new \DateTime('now')); + } + } }