| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Place;
- use ApiPlatform\Metadata\ApiResource;
- use App\Entity\Access\Access;
- use App\Entity\Core\AbstractRepair;
- // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
- use App\Entity\Core\Tagg;
- use App\Entity\Person\CommissionMember;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * @todo : A la suite de la migration, il faut supprimer le nom de la table pour avoir une table PlaceRepair, et supprimer l'attribut discr.
- * @todo : migration table tag_repair
- *
- * Réparation effectuée sur un lieu (Place)
- */
- // #[Auditable]
- #[ApiResource(operations: [])]
- #[ORM\Entity]
- class PlaceRepair extends AbstractRepair
- {
- #[ORM\ManyToOne(inversedBy: 'placeRepairProviders')]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
- protected ?Access $provider = null;
- #[ORM\ManyToOne(inversedBy: 'repairs')]
- protected ?Place $place = null;
- /** @var Collection<int, Tagg> */
- #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'placeRepairs', cascade: ['persist'])]
- #[ORM\JoinTable(name: 'tag_repair')]
- #[ORM\JoinColumn(name: 'repair_id', referencedColumnName: 'id')]
- #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
- protected Collection $tags;
- public function __construct()
- {
- $this->tags = new ArrayCollection();
- }
- public function getProvider(): ?Access
- {
- return $this->provider;
- }
- public function setProvider(?Access $provider): self
- {
- $this->provider = $provider;
- return $this;
- }
- public function getPlace(): ?Place
- {
- return $this->place;
- }
- public function setPlace(?Place $place): self
- {
- $this->place = $place;
- return $this;
- }
- public function getTags(): Collection
- {
- return $this->tags;
- }
- public function addTag(Tagg $tag): self
- {
- if (!$this->tags->contains($tag)) {
- $this->tags[] = $tag;
- }
- return $this;
- }
- public function removeTag(Tagg $tag): self
- {
- $this->tags->removeElement($tag);
- return $this;
- }
- }
|