| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Education;
- use ApiPlatform\Metadata\ApiResource;
- use App\Entity\Organization\Organization;
- // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * Catégorie de l'enseignement Education.
- */
- #[ApiResource(operations: [])]
- // #[Auditable]
- #[ORM\Entity]
- class EducationCategory
- {
- #[ORM\Id]
- #[ORM\Column]
- #[ORM\GeneratedValue]
- private ?int $id = null;
- #[ORM\ManyToOne(inversedBy: 'educationCategories')]
- #[ORM\JoinColumn(nullable: false)]
- private Organization $organization;
- /** @var Collection<int, Education> */
- #[ORM\OneToMany(targetEntity: Education::class, mappedBy: 'educationCategory', orphanRemoval: true)]
- private Collection $educations;
- public function __construct()
- {
- $this->educations = new ArrayCollection();
- }
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getOrganization(): ?Organization
- {
- return $this->organization;
- }
- public function setOrganization(?Organization $organization): self
- {
- $this->organization = $organization;
- return $this;
- }
- /**
- * @return Collection<int, Education>
- */
- public function getEducations(): Collection
- {
- return $this->educations;
- }
- public function addEducation(Education $education): self
- {
- if (!$this->educations->contains($education)) {
- $this->educations[] = $education;
- $education->setEducationCategory($this);
- }
- return $this;
- }
- public function removeEducation(Education $education): self
- {
- if ($this->educations->removeElement($education)) {
- // set the owning side to null (unless already changed)
- if ($education->getEducationCategory() === $this) {
- $education->setEducationCategory(null);
- }
- }
- return $this;
- }
- }
|