| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Core;
- use App\Entity\Access\Access;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- #[ORM\MappedSuperclass]
- abstract class AbstractControl
- {
- #[ORM\Id]
- #[ORM\Column]
- #[ORM\GeneratedValue]
- protected ?int $id = null;
- #[ORM\ManyToOne(inversedBy: 'accompanistControl')]
- #[ORM\JoinColumn(nullable: true)]
- protected Access $accompanist;
- #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'controls', cascade: ['persist'], orphanRemoval: false)]
- protected Collection $tags;
- public function __construct()
- {
- $this->tags = new ArrayCollection();
- }
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getAccompanist(): Access
- {
- return $this->accompanist;
- }
- public function setAccompanist(Access $accompanist): self
- {
- $this->accompanist = $accompanist;
- return $this;
- }
- public function getTags(): Collection
- {
- return $this->tags;
- }
- public function addTag(Tagg $tag): self
- {
- if (!$this->tags->contains($tag)) {
- $this->tags[] = $tag;
- $tag->addControl($this);
- }
- return $this;
- }
- public function removeTag(Tagg $tag): self
- {
- if ($this->tags->removeElement($tag)) {
- $tag->addControl($this);
- }
- return $this;
- }
- }
|