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');
60 $this->applications
= new ArrayCollection();
61 $this->users
= new ArrayCollection();
69 public function getId(): int {
76 * @param string $title
80 public function setTitle(string $title): Dance
{
81 $this->title
= $title;
91 public function getTitle(): string {
98 * @param \DateTime $created
102 public function setCreated(\DateTime
$created): Dance
{
103 $this->created
= $created;
113 public function getCreated(): \DateTime
{
114 return $this->created
;
120 * @param \DateTime $updated
124 public function setUpdated(\DateTime
$updated): Dance
{
125 $this->updated
= $updated;
135 public function getUpdated(): \DateTime
{
136 return $this->updated
;
142 * @param Application $application
146 public function addApplication(Application
$application): Dance
{
147 $this->applications
[] = $application;
155 * @param Application $application
159 public function removeApplication(Application
$application): bool {
160 return $this->applications
->removeElement($application);
166 * @return ArrayCollection
168 public function getApplications(): ArrayCollection
{
169 return $this->applications
;
179 public function addUser(User
$user): Dance
{
180 $this->users
[] = $user;
192 public function removeUser(User
$user): bool {
193 return $this->users
->removeElement($user);
199 * @return ArrayCollection
201 public function getUsers(): ArrayCollection
{
208 public function preUpdate(PreUpdateEventArgs
$eventArgs) {
209 //Check that we have a dance instance
210 if (($dance = $eventArgs->getEntity()) instanceof Dance
) {
212 $dance->setUpdated(new \
DateTime('now'));
217 * Returns a string representation of the slot
221 public function __toString(): string {