| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Education;
- use ApiPlatform\Metadata\ApiResource;
- use App\Entity\Access\Access;
- // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * Fait le lien entre un Access (professeur) et un Education (enseignement).
- */
- #[ApiResource(operations: [])]
- // #[Auditable]
- #[ORM\Entity]
- class EducationTeacher
- {
- #[ORM\Id]
- #[ORM\Column]
- #[ORM\GeneratedValue]
- private ?int $id = null;
- #[ORM\ManyToOne(inversedBy: 'educationTeachers')]
- #[ORM\JoinColumn(onDelete: 'CASCADE')]
- private ?Education $education = null;
- #[ORM\ManyToOne(inversedBy: 'educationTeachers')]
- private ?Access $teacher = null;
- /** @var Collection<int, SeizurePeriodNotation> */
- #[ORM\OneToMany(targetEntity: SeizurePeriodNotation::class, mappedBy: 'educationTeacher', cascade: ['persist', 'remove'], orphanRemoval: true)]
- private Collection $seizurePeriodNotations;
- public function __construct()
- {
- $this->seizurePeriodNotations = new ArrayCollection();
- }
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getEducation(): ?Education
- {
- return $this->education;
- }
- public function setEducation(?Education $education): self
- {
- $this->education = $education;
- return $this;
- }
- public function getTeacher(): ?Access
- {
- return $this->teacher;
- }
- public function setTeacher(?Access $teacher): self
- {
- $this->teacher = $teacher;
- return $this;
- }
- /**
- * @return Collection<int, SeizurePeriodNotation>
- */
- public function getSeizurePeriodNotations(): Collection
- {
- return $this->seizurePeriodNotations;
- }
- public function addSeizurePeriodNotation(SeizurePeriodNotation $seizurePeriodNotation): self
- {
- if (!$this->seizurePeriodNotations->contains($seizurePeriodNotation)) {
- $this->seizurePeriodNotations[] = $seizurePeriodNotation;
- $seizurePeriodNotation->setEducationTeacher($this);
- }
- return $this;
- }
- public function removeSeizurePeriodNotation(SeizurePeriodNotation $seizurePeriodNotation): self
- {
- if ($this->seizurePeriodNotations->removeElement($seizurePeriodNotation)) {
- // set the owning side to null (unless already changed)
- if ($seizurePeriodNotation->getEducationTeacher() === $this) {
- $seizurePeriodNotation->setEducationTeacher(null);
- }
- }
- return $this;
- }
- }
|