*/ #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'educationNotations', cascade: ['persist'])] #[ORM\JoinTable(name: 'tag_educationNotation')] #[ORM\JoinColumn(name: 'educationNotation_id', referencedColumnName: 'id')] #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')] private Collection $tags; // @see https://github.com/symfony/symfony/discussions/43599#discussioncomment-1514811 #[ORM\Column(type: 'decimal', precision: 10, scale: 2, nullable: true)] #[Assert\Range(notInRangeMessage: 'between_{{ min }}_and_{{ max }}', min: 0, max: 100)] private ?string $note = null; public function __construct() { $this->tags = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getEducationStudent(): ?EducationStudent { return $this->educationStudent; } public function setEducationStudent(?EducationStudent $educationStudent): self { $this->educationStudent = $educationStudent; return $this; } public function getCriteriaNotation(): ?CriteriaNotation { return $this->criteriaNotation; } public function setCriteriaNotation(?CriteriaNotation $criteriaNotation): self { $this->criteriaNotation = $criteriaNotation; return $this; } public function getCriteriaNotationConfig(): ?EducationNotationCriteriaConfig { return $this->criteriaNotationConfig; } public function setCriteriaNotationConfig(?EducationNotationCriteriaConfig $criteriaNotationConfig): self { $this->criteriaNotationConfig = $criteriaNotationConfig; return $this; } /** * @return Collection */ 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; } public function setNote(?float $note): self { $this->note = (string)$note; return $this; } public function getNote(): ?float { // TODO: pour moi le round il est pas à sa place ici? vaudrait pas mieux le mettre dans le setter? return !is_null($this->note) ? round((float)$this->note, 2) : null; } }