src/Entity/SectionPerson.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SectionPersonRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassSectionPersonRepository::class)]
  8. class SectionPerson
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'text'nullabletrue)]
  15.     private $comment;
  16.     #[ORM\ManyToOne(targetEntityPerson::class, inversedBy'sectionPersons')]
  17.     #[ORM\JoinColumn(nullablefalse)]
  18.     private $person;
  19.     #[ORM\ManyToOne(targetEntitySection::class, inversedBy'sectionPersons')]
  20.     #[ORM\JoinColumn(nullablefalse)]
  21.     private $section;
  22.     #[ORM\OneToMany(mappedBy'sectionPerson'targetEntitySectionPersonMeta::class, cascade: ['persist''remove'])]
  23.     private $sectionPersonMetas;
  24.     public function __construct()
  25.     {
  26.         $this->sectionPersonMetas = new ArrayCollection();
  27.     }
  28.     public function getId(): ?int
  29.     {
  30.         return $this->id;
  31.     }
  32.     public function getComment(): ?string
  33.     {
  34.         return $this->comment;
  35.     }
  36.     public function setComment(?string $comment): self
  37.     {
  38.         $this->comment $comment;
  39.         return $this;
  40.     }
  41.     public function getPerson(): ?Person
  42.     {
  43.         return $this->person;
  44.     }
  45.     public function setPerson(?Person $person): self
  46.     {
  47.         $this->person $person;
  48.         return $this;
  49.     }
  50.     public function getSection(): ?Section
  51.     {
  52.         return $this->section;
  53.     }
  54.     public function setSection(?Section $section): self
  55.     {
  56.         $this->section $section;
  57.         return $this;
  58.     }
  59.     /**
  60.      * @return Collection<int, SectionPersonMeta>
  61.      */
  62.     public function getSectionPersonMetas(): Collection
  63.     {
  64.         return $this->sectionPersonMetas;
  65.     }
  66.     public function addSectionPersonMeta(SectionPersonMeta $sectionPersonMeta): self
  67.     {
  68.         if (!$this->sectionPersonMetas->contains($sectionPersonMeta)) {
  69.             $this->sectionPersonMetas[] = $sectionPersonMeta;
  70.             $sectionPersonMeta->setSectionPerson($this);
  71.         }
  72.         return $this;
  73.     }
  74.     public function removeSectionPersonMeta(SectionPersonMeta $sectionPersonMeta): self
  75.     {
  76.         if ($this->sectionPersonMetas->removeElement($sectionPersonMeta)) {
  77.             // set the owning side to null (unless already changed)
  78.             if ($sectionPersonMeta->getSectionPerson() === $this) {
  79.                 $sectionPersonMeta->setSectionPerson(null);
  80.             }
  81.         }
  82.         return $this;
  83.     }
  84. }