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() {
50 $this->sessions
= new ArrayCollection();
58 public function getId(): int {
65 * @param string $title
69 public function setTitle(string $title) {
70 $this->title
= $title;
80 public function getTitle(): string {
87 * @param \DateTime $created
91 public function setCreated(\DateTime
$created) {
92 $this->created
= $created;
102 public function getCreated(): \DateTime
{
103 return $this->created
;
109 * @param \DateTime $updated
113 public function setUpdated(\DateTime
$updated) {
114 $this->updated
= $updated;
124 public function getUpdated(): \DateTime
{
125 return $this->updated
;
131 * @param Session $session
135 public function addSession(Session
$session): Slot
{
136 $this->sessions
[] = $session;
144 * @param Session $session
146 public function removeSession(Session
$session): bool {
147 return $this->sessions
->removeElement($session);
153 * @return ArrayCollection
155 public function getSessions(): ArrayCollection
{
156 return $this->sessions
;
162 public function preUpdate(PreUpdateEventArgs
$eventArgs) {
163 //Check that we have a slot instance
164 if (($slot = $eventArgs->getEntity()) instanceof Slot
) {
166 $slot->setUpdated(new \
DateTime('now'));
171 * Returns a string representation of the slot
175 public function __toString(): string {