src/Entity/Criteria5Item.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\Criteria5ItemRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=Criteria5ItemRepository::class)
  9.  */
  10. class Criteria5Item
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $label;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $code;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=Criteria5::class, inversedBy="criteria5Items")
  28.      * @ORM\JoinColumn(nullable=false)
  29.      */
  30.     private $criteria5;
  31.     /**
  32.      * @ORM\ManyToMany(targetEntity=BlogPostCategory::class, mappedBy="criteria5Items")
  33.      */
  34.     private $blogPostCategories;
  35.     
  36.     /**
  37.      * @ORM\ManyToMany(targetEntity=Instance::class, mappedBy="criteria5Items")
  38.      */
  39.     private Collection $instances;
  40.     
  41.     public function __construct()
  42.     {
  43.         $this->blogPostCategories = new ArrayCollection();
  44.         $this->instances = new ArrayCollection();
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getLabel(): ?string
  51.     {
  52.         return $this->label;
  53.     }
  54.     public function setLabel(string $label): self
  55.     {
  56.         $this->label $label;
  57.         return $this;
  58.     }
  59.     public function getCode(): ?string
  60.     {
  61.         return $this->code;
  62.     }
  63.     public function setCode(string $code): self
  64.     {
  65.         $this->code $code;
  66.         return $this;
  67.     }
  68.     public function getCriteria5(): ?Criteria5
  69.     {
  70.         return $this->criteria5;
  71.     }
  72.     public function setCriteria5(?Criteria5 $criteria5): self
  73.     {
  74.         $this->criteria5 $criteria5;
  75.         return $this;
  76.     }
  77.     /**
  78.      * @return Collection<int, BlogPostCategory>
  79.      */
  80.     public function getBlogPostCategories(): Collection
  81.     {
  82.         return $this->blogPostCategories;
  83.     }
  84.     
  85.     /**
  86.      * @return Collection<int, Instance>
  87.      */
  88.     public function getInstances(): Collection
  89.     {
  90.         return $this->instances;
  91.     }
  92.     public function addInstance(Instance $instance): self
  93.     {
  94.         if (!$this->instances->contains($instance)) {
  95.             $this->instances[] = $instance;
  96.             $instance->addCriteria5Item($this);
  97.         }
  98.         return $this;
  99.     }
  100.     public function removeInstance(Instance $instance): self
  101.     {
  102.         if ($this->instances->removeElement($instance)) {
  103.             $instance->removeCriteria5Item($this);
  104.         }
  105.         return $this;
  106.     }
  107.     
  108.     public function __toString(): string
  109.     {
  110.         return $this->getLabel();
  111.     }
  112. }