<?php
namespace App\Entity;
use App\Repository\ReportCardRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ReportCardRepository::class)
*/
class ReportCard
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=60, unique=true)
*/
private $code;
/**
* @ORM\Column(type="string", length=128)
*/
private $label;
/**
* @ORM\Column(type="float")
*/
private $note_on;
/**
* @ORM\ManyToOne(targetEntity=Establishment::class, inversedBy="reportCards")
* @ORM\JoinColumn(nullable=false)
*/
private $establishment;
/**
* @ORM\ManyToOne(targetEntity=SchoolYear::class, inversedBy="reportCards")
* @ORM\JoinColumn(nullable=false)
*/
private $schoolYear;
/**
* @ORM\ManyToOne(targetEntity=SchoolYearPeriode::class, inversedBy="reportCards")
* @ORM\JoinColumn(nullable=false)
*/
private $schoolYearPeriode;
/**
* @ORM\ManyToOne(targetEntity=SettingLevel::class, inversedBy="reportCards")
* @ORM\JoinColumn(nullable=false)
*/
private $level;
/**
* @ORM\Column(type="float")
*/
private $coefficient;
/**
* @ORM\Column(type="integer")
*/
private $order_num;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $created_at;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $updated_at;
/**
* @ORM\Column(type="integer")
*/
private $created_by;
/**
* @ORM\Column(type="integer")
*/
private $updated_by;
/**
* @ORM\OneToMany(targetEntity=SchoolReportCard::class, mappedBy="reportCard")
*/
private $schoolReportCards;
/**
* @ORM\Column(type="boolean")
*/
private $is_validated;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $report_card_average;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $level_average;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $smallest_average;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $strongest_average;
/**
* @ORM\OneToMany(targetEntity=SchoolAssessment::class, mappedBy="reportCard")
*/
private $schoolAssessments;
public function __construct()
{
$this->order_num = time();
$this->label = 'BULLETIN DE NOTES :';
$this->note_on = 20;
$this->is_validated = false;
$this->coefficient = 1;
$this->schoolReportCards = new ArrayCollection();
$this->schoolAssessments = new ArrayCollection();
}
public function __toString()
{
return $this->getLabel().' '.$this->getSchoolYearPeriode()->getLabel().' - '.$this->getLevel()->getLabel();
}
public function getId(): ?int
{
return $this->id;
}
public function getEstablishment(): ?Establishment
{
return $this->establishment;
}
public function setEstablishment(?Establishment $establishment): self
{
$this->establishment = $establishment;
return $this;
}
public function getSchoolYear(): ?SchoolYear
{
return $this->schoolYear;
}
public function setSchoolYear(?SchoolYear $schoolYear): self
{
$this->schoolYear = $schoolYear;
return $this;
}
public function getSchoolYearPeriode(): ?SchoolYearPeriode
{
return $this->schoolYearPeriode;
}
public function setSchoolYearPeriode(?SchoolYearPeriode $schoolYearPeriode): self
{
$this->schoolYearPeriode = $schoolYearPeriode;
return $this;
}
public function getLevel(): ?SettingLevel
{
return $this->level;
}
public function setLevel(?SettingLevel $level): self
{
$this->level = $level;
return $this;
}
public function getCoefficient(): ?float
{
return $this->coefficient;
}
public function setCoefficient(float $coefficient): self
{
$this->coefficient = $coefficient;
return $this;
}
public function getOrderNum(): ?int
{
return $this->order_num;
}
public function setOrderNum(int $order_num): self
{
$this->order_num = $order_num;
return $this;
}
/**
* @return Collection|SchoolReportCard[]
*/
public function getSchoolReportCards(): Collection
{
return $this->schoolReportCards;
}
public function addSchoolReportCard(SchoolReportCard $schoolReportCard): self
{
if (!$this->schoolReportCards->contains($schoolReportCard)) {
$this->schoolReportCards[] = $schoolReportCard;
$schoolReportCard->setReportCard($this);
}
return $this;
}
public function removeSchoolReportCard(SchoolReportCard $schoolReportCard): self
{
if ($this->schoolReportCards->removeElement($schoolReportCard)) {
// set the owning side to null (unless already changed)
if ($schoolReportCard->getReportCard() === $this) {
$schoolReportCard->setReportCard(null);
}
}
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): self
{
$this->label = $label;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeImmutable $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updated_at;
}
public function setUpdatedAt(\DateTimeImmutable $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
public function getCreatedBy(): ?int
{
return $this->created_by;
}
public function setCreatedBy(int $created_by): self
{
$this->created_by = $created_by;
return $this;
}
public function getUpdatedBy(): ?int
{
return $this->updated_by;
}
public function setUpdatedBy(int $updated_by): self
{
$this->updated_by = $updated_by;
return $this;
}
public function getIsValidated(): ?bool
{
return $this->is_validated;
}
public function setIsValidated(bool $is_validated): self
{
$this->is_validated = $is_validated;
return $this;
}
public function getNoteOn(): ?float
{
return $this->note_on;
}
public function setNoteOn(float $note_on): self
{
$this->note_on = $note_on;
return $this;
}
public function getReportCardAverage(): ?float
{
return $this->report_card_average;
}
public function setReportCardAverage(?float $report_card_average): self
{
$this->report_card_average = $report_card_average;
return $this;
}
public function getLevelAverage(): ?float
{
return $this->level_average;
}
public function setLevelAverage(?float $level_average): self
{
$this->level_average = $level_average;
return $this;
}
public function getSmallestAverage(): ?float
{
return $this->smallest_average;
}
public function setSmallestAverage(?float $smallest_average): self
{
$this->smallest_average = $smallest_average;
return $this;
}
public function getStrongestAverage(): ?float
{
return $this->strongest_average;
}
public function setStrongestAverage(?float $strongest_average): self
{
$this->strongest_average = $strongest_average;
return $this;
}
/**
* @return Collection|SchoolAssessment[]
*/
public function getSchoolAssessments(): Collection
{
return $this->schoolAssessments;
}
public function addSchoolAssessment(SchoolAssessment $schoolAssessment): self
{
if (!$this->schoolAssessments->contains($schoolAssessment)) {
$this->schoolAssessments[] = $schoolAssessment;
$schoolAssessment->setReportCard($this);
}
return $this;
}
public function removeSchoolAssessment(SchoolAssessment $schoolAssessment): self
{
if ($this->schoolAssessments->removeElement($schoolAssessment)) {
// set the owning side to null (unless already changed)
if ($schoolAssessment->getReportCard() === $this) {
$schoolAssessment->setReportCard(null);
}
}
return $this;
}
}