src/Entity/Meeting.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\MeetingRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use ApiPlatform\Core\Annotation\ApiResource;
  6. use ApiPlatform\Core\Annotation\ApiFilter;
  7. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. /**
  10.  * @ORM\Entity(repositoryClass=MeetingRepository::class)
  11.  * @ORM\HasLifecycleCallbacks()
  12.  * @ApiResource(
  13.  *     normalizationContext={"groups"={"meeting:read", "base:read", "assign:read"}},
  14.  *     denormalizationContext={"groups"={"meeting:write", "base:write", "assign:write"}},
  15.  * )
  16.  * @ApiFilter(
  17.  *     SearchFilter::class,
  18.  *     properties={
  19.  *          "parent": "exact",
  20.  *     }
  21.  * )
  22.  */
  23. class Meeting
  24. {
  25.     /**
  26.      * @ORM\Id
  27.      * @ORM\GeneratedValue
  28.      * @ORM\Column(type="integer")
  29.      * @Groups({"meeting:read"})
  30.      */
  31.     private $id;
  32.     /**
  33.      * @ORM\Column(type="string", length=255)
  34.      * @Groups({"meeting:read", "meeting:write"})
  35.      */
  36.     private $name;
  37.     /**
  38.      * @ORM\Column(type="date")
  39.      * @Groups({"meeting:read", "meeting:write"})
  40.      */
  41.     private $startDate;
  42.     /**
  43.      * @ORM\Column(type="integer")
  44.      * @Groups({"meeting:read", "meeting:write"})
  45.      */
  46.     private $startHour;
  47.     /**
  48.      * @ORM\Column(type="integer", nullable=true)
  49.      * @Groups({"meeting:read", "meeting:write"})
  50.      */
  51.     private $startMinute;
  52.     /**
  53.      * @ORM\Column(type="date", nullable=true)
  54.      * @Groups({"meeting:read", "meeting:write"})
  55.      */
  56.     private $endDate;
  57.     /**
  58.      * @ORM\Column(type="integer")
  59.      * @Groups({"meeting:read", "meeting:write"})
  60.      */
  61.     private $endHour;
  62.     /**
  63.      * @ORM\Column(type="integer", nullable=true)
  64.      * @Groups({"meeting:read", "meeting:write"})
  65.      */
  66.     private $endMinute;
  67.     /**
  68.      * @ORM\Column(type="string", length=255, nullable=true)
  69.      * @Groups({"meeting:read", "meeting:write"})
  70.      */
  71.     private $location;
  72.     /**
  73.      * @ORM\Column(type="text", nullable=true)
  74.      * @Groups({"meeting:read", "meeting:write"})
  75.      */
  76.     private $description;
  77.     /**
  78.      * @ORM\Column(type="string", length=255, nullable=true)
  79.      * @Groups({"meeting:read", "meeting:write", "base:read"})
  80.      */
  81.     private $parent;
  82.     /**
  83.      * @ORM\Column(type="integer", nullable=true)
  84.      * @Groups({"meeting:read", "meeting:write"})
  85.      */
  86.     private $parentId;
  87.     /**
  88.      * @ORM\Column(type="json", nullable=true)
  89.      * @Groups({"meeting:read", "meeting:write"})
  90.      */
  91.     private $attachments = [];
  92.     /**
  93.      * @ORM\Column(type="string", length=255, nullable=true)
  94.      * @Groups({"meeting:read", "meeting:write"})
  95.      */
  96.     private $meridiemStart;
  97.     /**
  98.      * @ORM\Column(type="string", length=255, nullable=true)
  99.      * @Groups({"meeting:read", "meeting:write"})
  100.      */
  101.     private $meridiemEnd;
  102.     public function getId(): ?int
  103.     {
  104.         return $this->id;
  105.     }
  106.     public function getName(): ?string
  107.     {
  108.         return $this->name;
  109.     }
  110.     public function setName(string $name): self
  111.     {
  112.         $this->name $name;
  113.         return $this;
  114.     }
  115.     public function getStartDate(): ?\DateTimeInterface
  116.     {
  117.         return $this->startDate;
  118.     }
  119.     public function setStartDate(\DateTimeInterface $startDate): self
  120.     {
  121.         $this->startDate $startDate;
  122.         return $this;
  123.     }
  124.     public function getStartHour(): ?int
  125.     {
  126.         return $this->startHour;
  127.     }
  128.     public function setStartHour(int $startHour): self
  129.     {
  130.         $this->startHour $startHour;
  131.         return $this;
  132.     }
  133.     public function getStartMinute(): ?int
  134.     {
  135.         return $this->startMinute;
  136.     }
  137.     public function setStartMinute(?int $startMinute): self
  138.     {
  139.         $this->startMinute $startMinute;
  140.         return $this;
  141.     }
  142.     public function getEndDate(): ?\DateTimeInterface
  143.     {
  144.         return $this->endDate;
  145.     }
  146.     public function setEndDate(?\DateTimeInterface $endDate): self
  147.     {
  148.         $this->endDate $endDate;
  149.         return $this;
  150.     }
  151.     public function getEndHour(): ?int
  152.     {
  153.         return $this->endHour;
  154.     }
  155.     public function setEndHour(int $endHour): self
  156.     {
  157.         $this->endHour $endHour;
  158.         return $this;
  159.     }
  160.     public function getEndMinute(): ?int
  161.     {
  162.         return $this->endMinute;
  163.     }
  164.     public function setEndMinute(?int $endMinute): self
  165.     {
  166.         $this->endMinute $endMinute;
  167.         return $this;
  168.     }
  169.     public function getLocation(): ?string
  170.     {
  171.         return $this->location;
  172.     }
  173.     public function setLocation(?string $location): self
  174.     {
  175.         $this->location $location;
  176.         return $this;
  177.     }
  178.     public function getDescription(): ?string
  179.     {
  180.         return $this->description;
  181.     }
  182.     public function setDescription(?string $description): self
  183.     {
  184.         $this->description $description;
  185.         return $this;
  186.     }
  187.     public function getParent(): ?string
  188.     {
  189.         return $this->parent;
  190.     }
  191.     public function setParent(?string $parent): self
  192.     {
  193.         $this->parent $parent;
  194.         return $this;
  195.     }
  196.     public function getParentId(): ?int
  197.     {
  198.         return $this->parentId;
  199.     }
  200.     public function setParentId(?int $parentId): self
  201.     {
  202.         $this->parentId $parentId;
  203.         return $this;
  204.     }
  205.     public function getStartTime()
  206.     {
  207.         if (!$this->startMinute) {
  208.             $this->startMinute 0;
  209.         }
  210.         if (!$this->startHour) {
  211.             $this->startHour 0;
  212.         }
  213.         $hour = ($this->startHour 10) ? "0{$this->startHour}$this->startHour;
  214.         $minute = ($this->startMinute 10) ? "0{$this->startMinute}$this->startMinute;
  215.         return "{$hour}:{$minute}";
  216.     }
  217.     public function getEndTime()
  218.     {
  219.         if (!$this->endMinute) {
  220.             $this->endMinute 0;
  221.         }
  222.         if (!$this->endHour) {
  223.             $this->endHour 0;
  224.         }
  225.         $hour = ($this->endHour 10) ? "0{$this->endHour}$this->endHour;
  226.         $minute = ($this->endMinute 10) ? "0{$this->endMinute}$this->endMinute;
  227.         return "{$hour}:{$minute}";
  228.     }
  229.     public function getAttachments(): ?array
  230.     {
  231.         return $this->attachments;
  232.     }
  233.     public function setAttachments($attachments): self
  234.     {
  235.         if (!is_array($attachments)) {
  236.             $attachments json_decode($attachmentstrue);
  237.         }
  238.         $this->attachments $attachments;
  239.         return $this;
  240.     }
  241.     public function getMeridiemStart(): ?string
  242.     {
  243.         return $this->meridiemStart;
  244.     }
  245.     public function setMeridiemStart(string $meridiemStart): self
  246.     {
  247.         $this->meridiemStart $meridiemStart;
  248.         return $this;
  249.     }
  250.     public function getMeridiemEnd(): ?string
  251.     {
  252.         return $this->meridiemEnd;
  253.     }
  254.     public function setMeridiemEnd(string $meridiemEnd): self
  255.     {
  256.         $this->meridiemEnd $meridiemEnd;
  257.         return $this;
  258.     }
  259. }