false])] #[Assert\Type(type: 'boolean')] #[Assert\NotNull] #[Groups(['educationnotation', 'report_card_educationstudent', 'educationstudent_notation_educationnotations', 'educationnotation_list'])] private $isValid = false; /** * @var string */ #[Groups(['educationnotation', 'educationstudent_notation_educationnotations', 'educationnotation_list'])] private $noteTemplate; /** * @var string */ #[Groups(['educationnotation', 'educationstudent_notation_educationnotations', 'educationnotation_list'])] private $noteOriTemplate; /** * @var ArrayCollection */ #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\Tagg', cascade: ['persist'], inversedBy: 'educationNotations')] #[Assert\Valid] #[ORM\JoinTable(name: 'tag_educationNotation', joinColumns: [], inverseJoinColumns: [])] #[ORM\JoinColumn(name: 'educationNotation_id', referencedColumnName: 'id')] #[ORM\JoinColumn(name: 'tag_id', referencedColumnName: 'id')] #[Groups(['eductionnotation_tags', 'educationstudent_notation_educationnotations', 'manage_tags'])] private $tags; public function __construct() { $this->tags = new ArrayCollection(); } /** * Sets id. * * @param int $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * Gets id. * * @return int */ public function getId() { return $this->id; } /** * Sets criteriaNotation. * * @param CriteriaNotation $criteriaNotation * * @return $this */ public function setCriteriaNotation($criteriaNotation) { $this->criteriaNotation = $criteriaNotation; return $this; } /** * Gets criteriaNotation. * * @return CriteriaNotation */ public function getCriteriaNotation() { return $this->criteriaNotation; } /** * Sets freeCriterion. * * @param string $freeCriterion * * @return $this */ public function setFreeCriterion($freeCriterion) { $this->freeCriterion = $freeCriterion; return $this; } /** * Gets freeCriterion. * * @return string */ public function getFreeCriterion() { return $this->freeCriterion; } /** * Sets period. * * @param string $period * * @return $this */ public function setPeriod($period) { if(empty($period) || $period=='') $period = null; $this->period = $period; return $this; } /** * Gets period. * * @return string */ public function getPeriod() { return $this->period; } /** * Sets date. * * @param \DateTime $date * * @return $this */ public function setDate(\DateTime $date = null) { $this->date = $date; return $this; } /** * Gets date. * * @return \DateTime */ public function getDate() { return $this->date ? $this->date->format('Y-m-d') : $this->date; } /** * Sets note. * * @param float $note * * @return $this */ public function setNote($note) { $this->note = (!is_null($note)) ? floatval($note) : $note; return $this; } /** * Gets note. * * @return float */ public function getNote() { if(is_null($this->note)) return $this->note; return round ( $this->note , 2 ); } /** * Sets mention. * * @param string $mention * * @return $this */ public function setMention($mention) { $this->mention = $mention; return $this; } /** * Gets mention. * * @return string */ public function getMention() { return $this->mention; } /** * Sets appreciation. * * @param string $appreciation * * @return $this */ public function setAppreciation($appreciation) { $this->appreciation = $appreciation; return $this; } /** * Gets appreciation. * * @return string */ public function getAppreciation() { return $this->appreciation; } /** * Set isValid * * @param boolean $isValid * * @return EducationNotation */ public function setIsValid($isValid) { $this->isValid = $isValid; return $this; } /** * Get isValid * * @return boolean */ public function getIsValid() { return $this->isValid; } /** * Set educationStudent * * @param \AppBundle\Entity\Education\EducationStudent $educationStudent * * @return EducationNotation */ public function setEducationStudent(\AppBundle\Entity\Education\EducationStudent $educationStudent) { $this->educationStudent = $educationStudent; return $this; } /** * Get educationStudent * * @return \AppBundle\Entity\Education\EducationStudent */ public function getEducationStudent() { return $this->educationStudent; } /** * Add tag * * @param \AppBundle\Entity\Core\Tagg $tag * * @return EducationNotation */ public function addTag(\AppBundle\Entity\Core\Tagg $tag) { $this->tags[] = $tag; return $this; } /** * Remove tag * * @param \AppBundle\Entity\Core\Tagg $tag */ public function removeTag(\AppBundle\Entity\Core\Tagg $tag) { $this->tags->removeElement($tag); } /** * Get tags * * @return \Doctrine\Common\Collections\Collection */ public function getTags() { return $this->tags; } public function getNoteTemplate($withNoteMax = true) { if(is_null($this->getNote())) return null; if(!$this->getCriteriaNotation()) return null; if($this->getCriteriaNotation()->getType() !== TypeCriteriaEnum::WITH_NOTATION) return null; $noteMax = $this->getEducationStudent()->getAccess()->getOrganization()->getParameters()->getAverage(); $note = (!is_null($this->getNote())) ? floatval(($this->getNote() * $noteMax) / 100) : $this->getNote(); $note = round ( $note , 2 ); return $withNoteMax ? $note . '/'. $noteMax : $note; } public function getNoteOriTemplate($withNoteMax = true) { if(is_null($this->getNote())) return null; if(!$this->getCriteriaNotation()) return null; if($this->getCriteriaNotation()->getType() !== TypeCriteriaEnum::WITH_NOTATION) return null; $noteMax = $this->getCriteriaNotation()->getNoteMax(); $note = (!is_null($this->getNote())) ? floatval(($this->getNote() * $noteMax) / 100) : $this->getNote(); $note = round ( $note , 2 ); return $withNoteMax ? $note . '/'. $noteMax : $note; } /** * Sets criteriaNotationConfig. * * @param EducationNotationCriteriaConfig $criteriaNotationConfig * * @return $this */ public function setCriteriaNotationConfig($criteriaNotationConfig) { $this->criteriaNotationConfig = $criteriaNotationConfig; return $this; } /** * Gets criteriaNotationConfig. * * @return EducationNotationCriteriaConfig */ public function getCriteriaNotationConfig() { return $this->criteriaNotationConfig; } /** * Pour elasticsearch... */ public function noteOrigine(){ return null; } public function noteRecalcul(){ return null; } }