Deprecated: Constant E_STRICT is deprecated in /var/www/PixelForce/vendor/symfony/error-handler/ErrorHandler.php on line 58

Deprecated: Constant E_STRICT is deprecated in /var/www/PixelForce/vendor/symfony/error-handler/ErrorHandler.php on line 76
Symfony Profiler

src/Entity/CalendarEventLabel.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CalendarEventLabelRepository;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use JsonSerializable;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. /**
  10.  * @ORM\Entity(repositoryClass=CalendarEventLabelRepository::class)
  11.  * @UniqueEntity(fields="value", message="Calendar event label is already taken.")
  12.  */
  13. class CalendarEventLabel implements JsonSerializable
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255)
  23.      */
  24.     private $name;
  25.     /**
  26.      * @ORM\Column(type="string", length=255)
  27.      * 
  28.      */
  29.     private $value;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private $color;
  34.     /**
  35.      * @ORM\OneToMany(targetEntity="CalendarEvent", mappedBy="calendarEventLabel")
  36.      */
  37.     private $calendarEvents;
  38.     public function __construct() {
  39.         $this->calendarEvents = new ArrayCollection();
  40.     }
  41.     public function getId(): ?int
  42.     {
  43.         return $this->id;
  44.     }
  45.     public function getName(): ?string
  46.     {
  47.         return $this->name;
  48.     }
  49.     public function setName(string $name): self
  50.     {
  51.         $this->name $name;
  52.         return $this;
  53.     }
  54.     public function getValue(): ?string
  55.     {
  56.         return $this->value;
  57.     }
  58.     public function setValue(string $value): self
  59.     {
  60.         $this->value $value;
  61.         return $this;
  62.     }
  63.     public function getColor(): ?string
  64.     {
  65.         return $this->color;
  66.     }
  67.     public function setColor(?string $color): self
  68.     {
  69.         $this->color $color;
  70.         return $this;
  71.     }
  72.     public function jsonSerialize()
  73.     {
  74.         $vars get_object_vars($this);
  75.         return $vars;
  76.     }
  77.     /**
  78.      * @return Collection<int, CalendarEvent>
  79.      */
  80.     public function getCalendarEvents(): Collection
  81.     {
  82.         return $this->calendarEvents;
  83.     }
  84.     public function addCalendarEvent(CalendarEvent $calendarEvent): static
  85.     {
  86.         if (!$this->calendarEvents->contains($calendarEvent)) {
  87.             $this->calendarEvents->add($calendarEvent);
  88.             $calendarEvent->setCalendarEventLabel($this);
  89.         }
  90.         return $this;
  91.     }
  92.     public function removeCalendarEvent(CalendarEvent $calendarEvent): static
  93.     {
  94.         if ($this->calendarEvents->removeElement($calendarEvent)) {
  95.             // set the owning side to null (unless already changed)
  96.             if ($calendarEvent->getCalendarEventLabel() === $this) {
  97.                 $calendarEvent->setCalendarEventLabel(null);
  98.             }
  99.         }
  100.         return $this;
  101.     }
  102. }