<?phpnamespace App\Entity;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\ORM\Mapping as ORM;class RookieDayDate { /** * @var int */ private $id; /** * @var \DateTime */ private $eventDay; /** * @var \App\Entity\RookieDaySetup */ private $setup; /** * @var \Doctrine\Common\Collections\Collection */ private $dateMappings; /** * @var \DateTime */ private $createdAt; /** * Constructor */ public function __construct() { $this->dateMappings = new ArrayCollection(); } /** * Get id. * * @return int */ public function getId() { return $this->id; } public function getSetup(): \App\Entity\RookieDaySetup { return $this->setup; } public function setSetup(\App\Entity\RookieDaySetup $setup): void { $this->setup = $setup; } /** * Set eventDay. * * @param \DateTime $eventDay * * @return RookieDayDate */ public function setEventDay($eventDay) { $this->eventDay = $eventDay; return $this; } /** * Get eventDay. * * @return \DateTime */ public function getEventDay() { return $this->eventDay; } /** * Add dateMapping. * * @param \App\Entity\RookieDaySchoolDateMapping $dateMapping * * @return RookieDaySchool */ public function addDateMapping(\App\Entity\RookieDaySchoolDateMapping $dateMapping) { $this->dateMappings[] = $dateMapping; return $this; } /** * Remove dateMapping. * * @param \App\Entity\RookieDaySchoolDateMapping $dateMapping * * @return boolean TRUE if this collection contained the specified element, FALSE otherwise. */ public function removeDateMapping(\App\Entity\RookieDaySchoolDateMapping $dateMapping) { return $this->dateMappings->removeElement($dateMapping); } /** * Get dateMappings. * * @return \Doctrine\Common\Collections\Collection */ public function getDateMappings() { return $this->dateMappings; } /** * Set createdAt. * * @param \DateTime $createdAt * * @return RookieDayDate */ public function setCreatedAt($createdAt) { $this->createdAt = $createdAt; return $this; } /** * Get createdAt. * * @return \DateTime */ public function getCreatedAt() { return $this->createdAt; } public function getDateString(): string { if (empty($this->eventDay)) { return ''; } return $this->eventDay->format('d.m.Y'); } public function getSchoolNames() { if (empty($this->dateMappings)) { return ''; } $strNames = ''; /* @var $dateMapping \App\Entity\RookieDaySchoolDateMapping */ foreach ($this->dateMappings as $dateMapping) { $strNames = $strNames . $dateMapping->getSchool()->getSchoolName() . ', '; } return substr($strNames, 0, -2); }}