<?phpnamespace App\Entity;/** * RookieTimeSlot */class RookieTimeSlot { /** * @var int */ private $id; /** * @var string */ private $name; /** * @var \DateTime */ private $openAt; /** * @var \DateTime */ private $closeAt; /** * @var \DateTime */ private $workFrom; /** * @var \DateTime */ private $workTo; /** * @var string|null */ private $comment; /** * @var \App\Entity\RookieTimeSlotState */ private $state; /** * @var \Doctrine\Common\Collections\Collection */ private $schools; /** * @var \App\Entity\RookieDistrict */ private $rookieDistrict; /** * Constructor */ public function __construct() { $this->schools = new \Doctrine\Common\Collections\ArrayCollection(); } /** * Get id. * * @return int */ public function getId() { return $this->id; } /** * Set name. * * @param string $name * * @return RookieTimeSlot */ public function setName($name) { $this->name = $name; return $this; } /** * Get name. * * @return string */ public function getName() { return $this->name; } /** * Set openAt. * * @param \DateTime $openAt * * @return RookieTimeSlot */ public function setOpenAt($openAt) { $this->openAt = $openAt; return $this; } /** * Get openAt. * * @return \DateTime */ public function getOpenAt() { return $this->openAt; } /** * Set closeAt. * * @param \DateTime $closeAt * * @return RookieTimeSlot */ public function setCloseAt($closeAt) { $this->closeAt = $closeAt; return $this; } /** * Get closeAt. * * @return \DateTime */ public function getCloseAt() { return $this->closeAt; } /** * Set comment. * * @param string|null $comment * * @return RookieTimeSlot */ public function setComment($comment = null) { $this->comment = $comment; return $this; } /** * Get comment. * * @return string|null */ public function getComment() { return $this->comment; } /** * Set state. * * @param \App\Entity\RookieTimeSlotState|null $state * * @return RookieTimeSlot */ public function setState(\App\Entity\RookieTimeSlotState $state = null) { $this->state = $state; return $this; } /** * Get state. * * @return \App\Entity\RookieTimeSlotState|null */ public function getState() { return $this->state; } /** * Set workFrom. * * @param \DateTime $workFrom * * @return RookieTimeSlot */ public function setWorkFrom($workFrom) { $this->workFrom = $workFrom; return $this; } /** * Get workFrom. * * @return \DateTime */ public function getWorkFrom() { return $this->workFrom; } /** * Set workTo. * * @param \DateTime $workTo * * @return RookieTimeSlot */ public function setWorkTo($workTo) { $this->workTo = $workTo; return $this; } /** * Get workTo. * * @return \DateTime */ public function getWorkTo() { return $this->workTo; } /** * Add school. * * @param \App\Entity\RookieSchool $school * * @return RookieTimeSlot */ public function addSchool(\App\Entity\RookieSchool $school) { $this->schools[] = $school; return $this; } /** * Remove school. * * @param \App\Entity\RookieSchool $school * * @return boolean TRUE if this collection contained the specified element, FALSE otherwise. */ public function removeSchool(\App\Entity\RookieSchool $school) { return $this->schools->removeElement($school); } /** * Get schools. * * @return \Doctrine\Common\Collections\Collection */ public function getSchools() { return $this->schools; } /** * Set rookieDistrict. * * @param \App\Entity\RookieDistrict|null $rookieDistrict * * @return RookieTimeSlot */ public function setRookieDistrict(\App\Entity\RookieDistrict $rookieDistrict = null) { $this->rookieDistrict = $rookieDistrict; return $this; } /** * Get rookieDistrict. * * @return \App\Entity\RookieDistrict|null */ public function getRookieDistrict() { return $this->rookieDistrict; } public function getSchoolsText() { $text = ''; foreach ($this->schools as $school) { $schoolName = $school->getName(); $text = $text . $schoolName . ", "; } if (strlen($text) > 2) { return substr($text, 0, -2); } return $text; } public function getTextLienz(){ return $this->name; } public function getText() { $name = $this->name; $openAt = $this->openAt->format("d.m.Y"); $closeAt = $this->closeAt->format("d.m.Y"); return "$name, $openAt - $closeAt"; } public function getWorkFromToText() { $strWorkFrom = $this->workFrom->format("d.m.Y"); $strWorkTo = $this->workTo->format("d.m.Y"); return "$strWorkFrom - $strWorkTo"; } public function __toString() { return $this->getText(); }}