src/Entity/RookieTimeSlot.php line 8

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. /**
  4.  * RookieTimeSlot
  5.  */
  6. class RookieTimeSlot {
  7.     /**
  8.      * @var int
  9.      */
  10.     private $id;
  11.     /**
  12.      * @var string
  13.      */
  14.     private $name;
  15.     /**
  16.      * @var \DateTime
  17.      */
  18.     private $openAt;
  19.     /**
  20.      * @var \DateTime
  21.      */
  22.     private $closeAt;
  23.     /**
  24.      * @var \DateTime
  25.      */
  26.     private $workFrom;
  27.     /**
  28.      * @var \DateTime
  29.      */
  30.     private $workTo;
  31.     /**
  32.      * @var string|null
  33.      */
  34.     private $comment;
  35.     /**
  36.      * @var \App\Entity\RookieTimeSlotState
  37.      */
  38.     private $state;
  39.     /**
  40.      * @var \Doctrine\Common\Collections\Collection
  41.      */
  42.     private $schools;
  43.     /**
  44.      * @var \App\Entity\RookieDistrict
  45.      */
  46.     private $rookieDistrict;    
  47.     
  48.     /**
  49.      * Constructor
  50.      */
  51.     public function __construct() {
  52.         $this->schools = new \Doctrine\Common\Collections\ArrayCollection();
  53.     }
  54.     /**
  55.      * Get id.
  56.      *
  57.      * @return int
  58.      */
  59.     public function getId() {
  60.         return $this->id;
  61.     }
  62.     /**
  63.      * Set name.
  64.      *
  65.      * @param string $name
  66.      *
  67.      * @return RookieTimeSlot
  68.      */
  69.     public function setName($name) {
  70.         $this->name $name;
  71.         return $this;
  72.     }
  73.     /**
  74.      * Get name.
  75.      *
  76.      * @return string
  77.      */
  78.     public function getName() {
  79.         return $this->name;
  80.     }
  81.     /**
  82.      * Set openAt.
  83.      *
  84.      * @param \DateTime $openAt
  85.      *
  86.      * @return RookieTimeSlot
  87.      */
  88.     public function setOpenAt($openAt) {
  89.         $this->openAt $openAt;
  90.         return $this;
  91.     }
  92.     /**
  93.      * Get openAt.
  94.      *
  95.      * @return \DateTime
  96.      */
  97.     public function getOpenAt() {
  98.         return $this->openAt;
  99.     }
  100.     /**
  101.      * Set closeAt.
  102.      *
  103.      * @param \DateTime $closeAt
  104.      *
  105.      * @return RookieTimeSlot
  106.      */
  107.     public function setCloseAt($closeAt) {
  108.         $this->closeAt $closeAt;
  109.         return $this;
  110.     }
  111.     /**
  112.      * Get closeAt.
  113.      *
  114.      * @return \DateTime
  115.      */
  116.     public function getCloseAt() {
  117.         return $this->closeAt;
  118.     }
  119.     /**
  120.      * Set comment.
  121.      *
  122.      * @param string|null $comment
  123.      *
  124.      * @return RookieTimeSlot
  125.      */
  126.     public function setComment($comment null) {
  127.         $this->comment $comment;
  128.         return $this;
  129.     }
  130.     /**
  131.      * Get comment.
  132.      *
  133.      * @return string|null
  134.      */
  135.     public function getComment() {
  136.         return $this->comment;
  137.     }
  138.     /**
  139.      * Set state.
  140.      *
  141.      * @param \App\Entity\RookieTimeSlotState|null $state
  142.      *
  143.      * @return RookieTimeSlot
  144.      */
  145.     public function setState(\App\Entity\RookieTimeSlotState $state null) {
  146.         $this->state $state;
  147.         return $this;
  148.     }
  149.     /**
  150.      * Get state.
  151.      *
  152.      * @return \App\Entity\RookieTimeSlotState|null
  153.      */
  154.     public function getState() {
  155.         return $this->state;
  156.     }
  157.     /**
  158.      * Set workFrom.
  159.      *
  160.      * @param \DateTime $workFrom
  161.      *
  162.      * @return RookieTimeSlot
  163.      */
  164.     public function setWorkFrom($workFrom) {
  165.         $this->workFrom $workFrom;
  166.         return $this;
  167.     }
  168.     /**
  169.      * Get workFrom.
  170.      *
  171.      * @return \DateTime
  172.      */
  173.     public function getWorkFrom() {
  174.         return $this->workFrom;
  175.     }
  176.     /**
  177.      * Set workTo.
  178.      *
  179.      * @param \DateTime $workTo
  180.      *
  181.      * @return RookieTimeSlot
  182.      */
  183.     public function setWorkTo($workTo) {
  184.         $this->workTo $workTo;
  185.         return $this;
  186.     }
  187.     /**
  188.      * Get workTo.
  189.      *
  190.      * @return \DateTime
  191.      */
  192.     public function getWorkTo() {
  193.         return $this->workTo;
  194.     }
  195.     /**
  196.      * Add school.
  197.      *
  198.      * @param \App\Entity\RookieSchool $school
  199.      *
  200.      * @return RookieTimeSlot
  201.      */
  202.     public function addSchool(\App\Entity\RookieSchool $school) {
  203.         $this->schools[] = $school;
  204.         return $this;
  205.     }
  206.     /**
  207.      * Remove school.
  208.      *
  209.      * @param \App\Entity\RookieSchool $school
  210.      *
  211.      * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  212.      */
  213.     public function removeSchool(\App\Entity\RookieSchool $school) {
  214.         return $this->schools->removeElement($school);
  215.     }
  216.     /**
  217.      * Get schools.
  218.      *
  219.      * @return \Doctrine\Common\Collections\Collection
  220.      */
  221.     public function getSchools() {
  222.         return $this->schools;
  223.     }
  224.     /**
  225.      * Set rookieDistrict.
  226.      *
  227.      * @param \App\Entity\RookieDistrict|null $rookieDistrict
  228.      *
  229.      * @return RookieTimeSlot
  230.      */
  231.     public function setRookieDistrict(\App\Entity\RookieDistrict $rookieDistrict null)
  232.     {
  233.         $this->rookieDistrict $rookieDistrict;
  234.         return $this;
  235.     }
  236.     /**
  237.      * Get rookieDistrict.
  238.      *
  239.      * @return \App\Entity\RookieDistrict|null
  240.      */
  241.     public function getRookieDistrict()
  242.     {
  243.         return $this->rookieDistrict;
  244.     }    
  245.     
  246.     public function getSchoolsText() {
  247.         $text '';
  248.         foreach ($this->schools as $school) {
  249.             $schoolName $school->getName();
  250.             $text $text $schoolName ", ";
  251.         }
  252.         if (strlen($text) > 2) {
  253.             return substr($text0, -2);
  254.         }
  255.         return $text;
  256.     }
  257.     public function getTextLienz(){
  258.         return $this->name;      
  259.     }
  260.     
  261.     public function getText() {
  262.         $name $this->name;
  263.         $openAt $this->openAt->format("d.m.Y");
  264.         $closeAt $this->closeAt->format("d.m.Y");
  265.         return "$name$openAt - $closeAt";
  266.     }
  267.     public function getWorkFromToText() {
  268.         $strWorkFrom $this->workFrom->format("d.m.Y");
  269.         $strWorkTo $this->workTo->format("d.m.Y");
  270.         return "$strWorkFrom - $strWorkTo";
  271.     }
  272.     public function __toString() {
  273.         return $this->getText();
  274.     }
  275. }