src/Entity/Criteria1Item.php line 14

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