1 <?php
declare(strict_types
=1);
4 * this file is part of the rapsys packbundle package.
6 * (c) raphaël gertz <symfony@rapsys.eu>
8 * for the full copyright and license information, please view the license
9 * file that was distributed with this source code.
12 namespace Rapsys\AirBundle\Entity
;
14 use Doctrine\Common\Collections\ArrayCollection
;
15 use Doctrine\ORM\Event\PreUpdateEventArgs
;
42 * @var ArrayCollection
44 private $applications;
47 * @var ArrayCollection
54 public function __construct() {
56 $this->created
= new \
DateTime('now');
57 $this->updated
= new \
DateTime('now');
58 $this->applications
= new ArrayCollection();
59 $this->users
= new ArrayCollection();
67 public function getId(): int {
74 * @param string $title
78 public function setTitle(string $title): Dance
{
79 $this->title
= $title;
89 public function getTitle(): string {
96 * @param \DateTime $created
100 public function setCreated(\DateTime
$created): Dance
{
101 $this->created
= $created;
111 public function getCreated(): \DateTime
{
112 return $this->created
;
118 * @param \DateTime $updated
122 public function setUpdated(\DateTime
$updated): Dance
{
123 $this->updated
= $updated;
133 public function getUpdated(): \DateTime
{
134 return $this->updated
;
140 * @param Application $application
144 public function addApplication(Application
$application): Dance
{
145 $this->applications
[] = $application;
153 * @param Application $application
157 public function removeApplication(Application
$application): bool {
158 return $this->applications
->removeElement($application);
164 * @return ArrayCollection
166 public function getApplications(): ArrayCollection
{
167 return $this->applications
;
177 public function addUser(User
$user): Dance
{
178 $this->users
[] = $user;
190 public function removeUser(User
$user): bool {
191 return $this->users
->removeElement($user);
197 * @return ArrayCollection
199 public function getUsers(): ArrayCollection
{
206 public function preUpdate(PreUpdateEventArgs
$eventArgs) {
207 //Check that we have an session instance
208 if (($dance = $eventArgs->getEntity()) instanceof Dance
) {
210 $dance->setUpdated(new \
DateTime('now'));
215 * Returns a string representation of the slot
219 public function __toString(): string {