|
@@ -5,14 +5,16 @@ namespace App\Entity\Education;
|
|
|
|
|
|
|
|
use ApiPlatform\Core\Annotation\ApiResource;
|
|
use ApiPlatform\Core\Annotation\ApiResource;
|
|
|
use App\Entity\Core\Tagg;
|
|
use App\Entity\Core\Tagg;
|
|
|
|
|
+use App\Repository\Education\EducationNotationRepository;
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
|
+use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Classe ... qui ...
|
|
* Classe ... qui ...
|
|
|
*/
|
|
*/
|
|
|
-#[ORM\Entity]
|
|
|
|
|
|
|
+#[ORM\Entity(repositoryClass: EducationNotationRepository::class)]
|
|
|
#[ApiResource(
|
|
#[ApiResource(
|
|
|
collectionOperations: [],
|
|
collectionOperations: [],
|
|
|
itemOperations: [
|
|
itemOperations: [
|
|
@@ -32,11 +34,11 @@ class EducationNotation
|
|
|
|
|
|
|
|
#[ORM\ManyToOne(inversedBy: 'educationNotations')]
|
|
#[ORM\ManyToOne(inversedBy: 'educationNotations')]
|
|
|
#[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
|
|
#[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
|
|
|
- private CriteriaNotation $criteriaNotation;
|
|
|
|
|
|
|
+ private ?CriteriaNotation $criteriaNotation;
|
|
|
|
|
|
|
|
#[ORM\ManyToOne(inversedBy: 'educationNotations')]
|
|
#[ORM\ManyToOne(inversedBy: 'educationNotations')]
|
|
|
#[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
|
|
#[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
|
|
|
- private EducationNotationCriteriaConfig $criteriaNotationConfig;
|
|
|
|
|
|
|
+ private ?EducationNotationCriteriaConfig $criteriaNotationConfig;
|
|
|
|
|
|
|
|
#[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'educationNotations', cascade: ['persist'])]
|
|
#[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'educationNotations', cascade: ['persist'])]
|
|
|
#[ORM\JoinTable(name: 'tag_educationNotation')]
|
|
#[ORM\JoinTable(name: 'tag_educationNotation')]
|
|
@@ -44,6 +46,14 @@ class EducationNotation
|
|
|
#[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
|
|
#[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
|
|
|
private Collection $tags;
|
|
private Collection $tags;
|
|
|
|
|
|
|
|
|
|
+ #[ORM\Column(type: 'decimal', precision: 10, scale: 2, nullable: true)]
|
|
|
|
|
+ #[Assert\Range(
|
|
|
|
|
+ notInRangeMessage: 'between_{{ min }}_and_{{ max }}',
|
|
|
|
|
+ min: 0,
|
|
|
|
|
+ max: 100
|
|
|
|
|
+ )]
|
|
|
|
|
+ private ?float $note;
|
|
|
|
|
+
|
|
|
public function __construct()
|
|
public function __construct()
|
|
|
{
|
|
{
|
|
|
$this->tags = new ArrayCollection();
|
|
$this->tags = new ArrayCollection();
|
|
@@ -113,4 +123,16 @@ class EducationNotation
|
|
|
|
|
|
|
|
return $this;
|
|
return $this;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public function setNote(?float $note): self
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->note = (!is_null($note)) ? (float)($note) : $note;
|
|
|
|
|
+ return $this;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function getNote(): ?float
|
|
|
|
|
+ {
|
|
|
|
|
+ if(is_null($this->note)) return $this->note;
|
|
|
|
|
+ return round ( $this->note , 2 );
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|