src/Entity/Criteria2Item.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\Criteria2ItemRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=Criteria2ItemRepository::class)
  9.  */
  10. class Criteria2Item
  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=Criteria2::class, inversedBy="criteria2Items")
  28.      * @ORM\JoinColumn(nullable=false)
  29.      */
  30.     private $criteria2;
  31.     /**
  32.      * @ORM\ManyToMany(targetEntity=BlogPostCategory::class, mappedBy="criteria1Items")
  33.      */
  34.     private $blogPostCategories;
  35.     /**
  36.      * @ORM\ManyToMany(targetEntity=Instance::class, mappedBy="criteria2Items")
  37.      */
  38.     private Collection $instances;
  39.     public function __construct()
  40.     {
  41.         $this->blogPostCategories = new ArrayCollection();
  42.         $this->instances = new ArrayCollection();
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getLabel(): ?string
  49.     {
  50.         return $this->label;
  51.     }
  52.     public function setLabel(string $label): self
  53.     {
  54.         $this->label $label;
  55.         return $this;
  56.     }
  57.     public function getCode(): ?string
  58.     {
  59.         return $this->code;
  60.     }
  61.     public function setCode(string $code): self
  62.     {
  63.         $this->code $code;
  64.         return $this;
  65.     }
  66.     public function getCriteria2(): ?Criteria2
  67.     {
  68.         return $this->criteria2;
  69.     }
  70.     public function setCriteria2(?Criteria2 $criteria2): self
  71.     {
  72.         $this->criteria2 $criteria2;
  73.         return $this;
  74.     }
  75.     /**
  76.      * @return Collection<int, BlogPostCategory>
  77.      */
  78.     public function getBlogPostCategories(): Collection
  79.     {
  80.         return $this->blogPostCategories;
  81.     }
  82.     /**
  83.      * @return Collection<int, Instance>
  84.      */
  85.     public function getInstances(): Collection
  86.     {
  87.         return $this->instances;
  88.     }
  89.     public function addInstance(Instance $instance): self
  90.     {
  91.         if (!$this->instances->contains($instance)) {
  92.             $this->instances[] = $instance;
  93.             $instance->addCriteria2Item($this);
  94.         }
  95.         return $this;
  96.     }
  97.     public function removeInstance(Instance $instance): self
  98.     {
  99.         if ($this->instances->removeElement($instance)) {
  100.             $instance->removeCriteria2Item($this);
  101.         }
  102.         return $this;
  103.     }
  104.     public function __toString(): string
  105.     {
  106.         return $this->getLabel();
  107.     }
  108. }