<?php declare(strict_types=1);
/*
- * this file is part of the rapsys packbundle package.
+ * This file is part of the Rapsys AirBundle package.
*
- * (c) raphaël gertz <symfony@rapsys.eu>
+ * (c) Raphaël Gertz <symfony@rapsys.eu>
*
- * for the full copyright and license information, please view the license
+ * For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
*/
class Application {
/**
- * @var integer
+ * Primary key
*/
- private $id;
+ private ?int $id = null;
/**
- * @var Dance
+ * Dance instance
*/
- private $dance;
+ private Dance $dance;
/**
- * @var float
+ * Score
*/
- private $score;
+ private ?float $score = null;
/**
- * @var \DateTime
+ * Cancel datetime
*/
- private $canceled;
+ private ?\DateTimeImmutable $canceled = null;
/**
- * @var \DateTime
+ * Create datetime
*/
- private $created;
+ private \DateTimeImmutable $created;
/**
- * @var \DateTime
+ * Update datetime
*/
- private $updated;
+ private \DateTimeImmutable $updated;
/**
- * @var \Rapsys\AirBundle\Entity\Session
+ * Session instance
*/
- private $session;
+ private $session = null;
/**
- * @var \Rapsys\AirBundle\Entity\User
+ * User instance
*/
- private $user;
+ private $user = null;
/**
* 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;
+ $this->created = new \DateTimeImmutable('now');
+ $this->updated = new \DateTimeImmutable('now');
}
/**
*
* @return integer
*/
- public function getId(): int {
+ public function getId(): ?int {
return $this->id;
}
/**
* Set canceled
*
- * @param \DateTime $canceled
+ * @param \DateTimeImmutable $canceled
*
* @return Application
*/
- public function setCanceled(?\DateTime $canceled): Application {
+ public function setCanceled(?\DateTimeImmutable $canceled): Application {
$this->canceled = $canceled;
return $this;
/**
* Get canceled
*
- * @return \DateTime
+ * @return \DateTimeImmutable
*/
- public function getCanceled(): ?\DateTime {
+ public function getCanceled(): ?\DateTimeImmutable {
return $this->canceled;
}
/**
* Set created
*
- * @param \DateTime $created
+ * @param \DateTimeImmutable $created
*
* @return Application
*/
- public function setCreated(\DateTime $created): Application {
+ public function setCreated(\DateTimeImmutable $created): Application {
$this->created = $created;
return $this;
/**
* Get created
*
- * @return \DateTime
+ * @return \DateTimeImmutable
*/
- public function getCreated(): \DateTime {
+ public function getCreated(): \DateTimeImmutable {
return $this->created;
}
/**
* Set updated
*
- * @param \DateTime $updated
+ * @param \DateTimeImmutable $updated
*
* @return Application
*/
- public function setUpdated(\DateTime $updated): Application {
+ public function setUpdated(\DateTimeImmutable $updated): Application {
$this->updated = $updated;
return $this;
/**
* Get updated
*
- * @return \DateTime
+ * @return \DateTimeImmutable
*/
- public function getUpdated(): \DateTime {
+ public function getUpdated(): \DateTimeImmutable {
return $this->updated;
}
//Check that we have an application instance
if (($application = $eventArgs->getObject()) instanceof Application) {
//Set updated value
- $application->setUpdated(new \DateTime('now'));
+ $application->setUpdated(new \DateTimeImmutable('now'));
}
}
}