|
|
@@ -46,9 +46,10 @@ class EducationNotation
|
|
|
#[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 ?float $note = null;
|
|
|
+ private ?string $note = null;
|
|
|
|
|
|
public function __construct()
|
|
|
{
|
|
|
@@ -122,17 +123,14 @@ class EducationNotation
|
|
|
|
|
|
public function setNote(?float $note): self
|
|
|
{
|
|
|
- $this->note = !is_null($note) ? (float) $note : $note;
|
|
|
+ $this->note = (string)$note;
|
|
|
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
public function getNote(): ?float
|
|
|
{
|
|
|
- if (is_null($this->note)) {
|
|
|
- return $this->note;
|
|
|
- }
|
|
|
-
|
|
|
- return round($this->note, 2);
|
|
|
+ // 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;
|
|
|
}
|
|
|
}
|