X-Git-Url: https://git.rapsys.eu/airbundle/blobdiff_plain/9aad88c45d93dadacd35176364b56df4734c017b..f972044e64e3c1f79f86b1b44c2f821a35e39e62:/Entity/Application.php?ds=inline diff --git a/Entity/Application.php b/Entity/Application.php index b54b1e2..b2672a1 100644 --- a/Entity/Application.php +++ b/Entity/Application.php @@ -1,11 +1,11 @@ + * (c) Raphaël Gertz * - * 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. */ @@ -18,46 +18,52 @@ use Doctrine\ORM\Event\PreUpdateEventArgs; */ class Application { /** - * @var integer + * Primary key */ - private $id; + private ?int $id = null; /** - * @var float + * Dance instance */ - private $score; + private Dance $dance; /** - * @var \DateTime + * Score */ - private $canceled; + private ?float $score = null; /** - * @var \DateTime + * Cancel datetime */ - private $created; + private ?\DateTime $canceled = null; /** - * @var \DateTime + * Create datetime */ - private $updated; + private \DateTime $created; /** - * @var \Rapsys\AirBundle\Entity\Session + * Update datetime */ - private $session; + private \DateTime $updated; /** - * @var \Rapsys\AirBundle\Entity\User + * Session instance */ - private $user; + private $session = null; + + /** + * User instance + */ + private $user = null; /** * Constructor */ public function __construct() { - $this->session = null; - $this->user = null; + //Set defaults + $this->created = new \DateTime('now'); + $this->updated = new \DateTime('now'); } /** @@ -65,10 +71,32 @@ class Application { * * @return integer */ - public function getId(): int { + public function getId(): ?int { return $this->id; } + /** + * Set dance + * + * @param Dance $dance + * + * @return Application + */ + public function setDance(Dance $dance): Application { + $this->dance = $dance; + + return $this; + } + + /** + * Get dance + * + * @return Dance + */ + public function getDance(): Dance { + return $this->dance; + } + /** * Set score * @@ -206,9 +234,9 @@ class Application { */ public function preUpdate(PreUpdateEventArgs $eventArgs) { //Check that we have an application instance - if (($user = $eventArgs->getEntity()) instanceof Application) { + if (($application = $eventArgs->getObject()) instanceof Application) { //Set updated value - $user->setUpdated(new \DateTime('now')); + $application->setUpdated(new \DateTime('now')); } } }