src/Entity/Criteria4Item.php line 14

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