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
49 public function __construct() {
51 $this->created
= new \
DateTime('now');
52 $this->updated
= new \
DateTime('now');
53 $this->sessions
= new ArrayCollection();
61 public function getId(): int {
68 * @param string $title
72 public function setTitle(string $title) {
73 $this->title
= $title;
83 public function getTitle(): string {
90 * @param \DateTime $created
94 public function setCreated(\DateTime
$created) {
95 $this->created
= $created;
105 public function getCreated(): \DateTime
{
106 return $this->created
;
112 * @param \DateTime $updated
116 public function setUpdated(\DateTime
$updated) {
117 $this->updated
= $updated;
127 public function getUpdated(): \DateTime
{
128 return $this->updated
;
134 * @param Session $session
138 public function addSession(Session
$session): Slot
{
139 $this->sessions
[] = $session;
147 * @param Session $session
149 public function removeSession(Session
$session): bool {
150 return $this->sessions
->removeElement($session);
156 * @return ArrayCollection
158 public function getSessions(): ArrayCollection
{
159 return $this->sessions
;
165 public function preUpdate(PreUpdateEventArgs
$eventArgs) {
166 //Check that we have a slot instance
167 if (($slot = $eventArgs->getEntity()) instanceof Slot
) {
169 $slot->setUpdated(new \
DateTime('now'));
174 * Returns a string representation of the slot
178 public function __toString(): string {