| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <?php
- declare (strict_types=1);
- namespace App\Entity\Education;
- use ApiPlatform\Metadata\Get;
- 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;
- use Symfony\Component\Validator\Constraints as Assert;
- /**
- * Classe ... qui ...
- */
- #[ApiResource(operations: [])]
- //#[Auditable]
- #[ORM\Entity]
- class CriteriaNotation
- {
- #[ORM\Id]
- #[ORM\Column]
- #[ORM\GeneratedValue]
- private ?int $id = null;
- #[ORM\ManyToOne(inversedBy: 'critereNotations')]
- #[ORM\JoinColumn(nullable: false)]
- private Organization $organization;
- #[ORM\OneToMany(mappedBy: 'criteriaNotation', targetEntity: EducationNotation::class)]
- private Collection $educationNotations;
- #[ORM\OneToMany(mappedBy: 'criteriaNotation', targetEntity: CustomNotation::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
- private Collection $customNotation;
- #[ORM\OneToMany(mappedBy: 'criteriaNotation', targetEntity: EducationNotationCriteriaConfig::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
- private Collection $educationNotationCriteriaConfigs;
- #[ORM\Column]
- #[Assert\Choice(callback: ['\\App\\Enum\\Education\\TypeCriteriaEnum', 'toArray'], message: 'invalid-type')]
- private string $type;
- #[ORM\Column]
- #[Assert\GreaterThanOrEqual(value: 0)]
- #[Assert\Range(notInRangeMessage: 'between_{{ min }}_and_{{ max }}', min: 0, max: 100)]
- private ?int $noteMax;
- public function __construct()
- {
- $this->educationNotations = new ArrayCollection();
- $this->customNotation = new ArrayCollection();
- $this->educationNotationCriteriaConfigs = 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, EducationNotation>
- */
- public function getEducationNotations(): Collection
- {
- return $this->educationNotations;
- }
- public function addEducationNotation(EducationNotation $educationNotation): self
- {
- if (!$this->educationNotations->contains($educationNotation)) {
- $this->educationNotations[] = $educationNotation;
- $educationNotation->setCriteriaNotation($this);
- }
- return $this;
- }
- public function removeEducationNotation(EducationNotation $educationNotation): self
- {
- if ($this->educationNotations->removeElement($educationNotation)) {
- // set the owning side to null (unless already changed)
- if ($educationNotation->getCriteriaNotation() === $this) {
- $educationNotation->setCriteriaNotation(null);
- }
- }
- return $this;
- }
- /**
- * @return Collection<int, CustomNotation>
- */
- public function getCustomNotation(): Collection
- {
- return $this->customNotation;
- }
- public function addCustomNotation(CustomNotation $customNotation): self
- {
- if (!$this->customNotation->contains($customNotation)) {
- $this->customNotation[] = $customNotation;
- $customNotation->setCriteriaNotation($this);
- }
- return $this;
- }
- public function removeCustomNotation(CustomNotation $customNotation): self
- {
- if ($this->customNotation->removeElement($customNotation)) {
- // set the owning side to null (unless already changed)
- if ($customNotation->getCriteriaNotation() === $this) {
- $customNotation->setCriteriaNotation(null);
- }
- }
- return $this;
- }
- /**
- * @return Collection<int, EducationNotationCriteriaConfig>
- */
- public function getEducationNotationCriteriaConfigs(): Collection
- {
- return $this->educationNotationCriteriaConfigs;
- }
- public function addEducationNotationCriteriaConfig(EducationNotationCriteriaConfig $educationNotationCriteriaConfig): self
- {
- if (!$this->educationNotationCriteriaConfigs->contains($educationNotationCriteriaConfig)) {
- $this->educationNotationCriteriaConfigs[] = $educationNotationCriteriaConfig;
- $educationNotationCriteriaConfig->setCriteriaNotation($this);
- }
- return $this;
- }
- public function removeEducationNotationCriteriaConfig(EducationNotationCriteriaConfig $educationNotationCriteriaConfig): self
- {
- if ($this->educationNotationCriteriaConfigs->removeElement($educationNotationCriteriaConfig)) {
- // set the owning side to null (unless already changed)
- if ($educationNotationCriteriaConfig->getCriteriaNotation() === $this) {
- $educationNotationCriteriaConfig->setCriteriaNotation(null);
- }
- }
- return $this;
- }
- public function getType(): ?string
- {
- return $this->type;
- }
- public function setType(string $type): self
- {
- $this->type = $type;
- return $this;
- }
- public function getNoteMax(): ?int
- {
- return $this->noteMax;
- }
- public function setNoteMax(int $noteMax): self
- {
- $this->noteMax = $noteMax;
- return $this;
- }
- }
|