src/Entity/RookieDayDate.php line 8

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. class RookieDayDate {
  6.     /**
  7.      * @var int
  8.      */
  9.     private $id;
  10.     /**
  11.      * @var \DateTime
  12.      */
  13.     private $eventDay;
  14.     /**
  15.      * @var \App\Entity\RookieDaySetup
  16.      */
  17.     private $setup;
  18.     /**
  19.      * @var \Doctrine\Common\Collections\Collection
  20.      */
  21.     private $dateMappings;
  22.     /**
  23.      * @var \DateTime
  24.      */
  25.     private $createdAt;
  26.     /**
  27.      * Constructor
  28.      */
  29.     public function __construct() {
  30.         $this->dateMappings = new ArrayCollection();
  31.     }
  32.     /**
  33.      * Get id.
  34.      *
  35.      * @return int
  36.      */
  37.     public function getId() {
  38.         return $this->id;
  39.     }
  40.     public function getSetup(): \App\Entity\RookieDaySetup {
  41.         return $this->setup;
  42.     }
  43.     public function setSetup(\App\Entity\RookieDaySetup $setup): void {
  44.         $this->setup $setup;
  45.     }
  46.     /**
  47.      * Set eventDay.
  48.      *
  49.      * @param \DateTime $eventDay
  50.      *
  51.      * @return RookieDayDate
  52.      */
  53.     public function setEventDay($eventDay) {
  54.         $this->eventDay $eventDay;
  55.         return $this;
  56.     }
  57.     /**
  58.      * Get eventDay.
  59.      *
  60.      * @return \DateTime
  61.      */
  62.     public function getEventDay() {
  63.         return $this->eventDay;
  64.     }
  65.     /**
  66.      * Add dateMapping.
  67.      *
  68.      * @param \App\Entity\RookieDaySchoolDateMapping $dateMapping
  69.      *
  70.      * @return RookieDaySchool
  71.      */
  72.     public function addDateMapping(\App\Entity\RookieDaySchoolDateMapping $dateMapping) {
  73.         $this->dateMappings[] = $dateMapping;
  74.         return $this;
  75.     }
  76.     /**
  77.      * Remove dateMapping.
  78.      *
  79.      * @param \App\Entity\RookieDaySchoolDateMapping $dateMapping
  80.      *
  81.      * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  82.      */
  83.     public function removeDateMapping(\App\Entity\RookieDaySchoolDateMapping $dateMapping) {
  84.         return $this->dateMappings->removeElement($dateMapping);
  85.     }
  86.     /**
  87.      * Get dateMappings.
  88.      *
  89.      * @return \Doctrine\Common\Collections\Collection
  90.      */
  91.     public function getDateMappings() {
  92.         return $this->dateMappings;
  93.     }
  94.     /**
  95.      * Set createdAt.
  96.      *
  97.      * @param \DateTime $createdAt
  98.      *
  99.      * @return RookieDayDate
  100.      */
  101.     public function setCreatedAt($createdAt) {
  102.         $this->createdAt $createdAt;
  103.         return $this;
  104.     }
  105.     /**
  106.      * Get createdAt.
  107.      *
  108.      * @return \DateTime
  109.      */
  110.     public function getCreatedAt() {
  111.         return $this->createdAt;
  112.     }
  113.     public function getDateString(): string {
  114.         if (empty($this->eventDay)) {
  115.             return '';
  116.         }
  117.         return $this->eventDay->format('d.m.Y');
  118.     }
  119.     public function getSchoolNames() {
  120.         if (empty($this->dateMappings)) {
  121.             return '';
  122.         }
  123.         $strNames '';
  124.         /* @var $dateMapping \App\Entity\RookieDaySchoolDateMapping */
  125.         foreach ($this->dateMappings as $dateMapping) {
  126.             $strNames $strNames $dateMapping->getSchool()->getSchoolName() . ', ';
  127.         }
  128.         return substr($strNames0, -2);
  129.     }
  130. }