["security" => "is_granted('ROLE_ADMIN') and object.getEducationStudent().getAccess().getOrganization().getId() == user.getOrganization().getId()"] ] )] class EducationNotation { #[ORM\Id] #[ORM\Column] #[ORM\GeneratedValue] private ?int $id = null; #[ORM\ManyToOne(inversedBy: 'educationNotations')] #[ORM\JoinColumn(nullable: false)] private EducationStudent $educationStudent; #[ORM\ManyToOne(inversedBy: 'educationNotations')] #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')] private ?CriteriaNotation $criteriaNotation; #[ORM\ManyToOne(inversedBy: 'educationNotations')] #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')] private ?EducationNotationCriteriaConfig $criteriaNotationConfig; #[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; #[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() { $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 = (!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 ); } }