<?php
namespace App\Entity;
use App\Repository\PrimaryParentNoteRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PrimaryParentNoteRepository::class)]
class PrimaryParentNote
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column]
private ?float $point = null;
#[ORM\OneToOne(inversedBy: 'primaryParentNote', cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(nullable: false)]
private ?Subject $subject = null;
#[ORM\ManyToOne(inversedBy: 'primaryParentNotes')]
#[ORM\JoinColumn(nullable: false)]
private ?School $school = null;
#[ORM\ManyToOne(inversedBy: 'primaryParentNotes')]
#[ORM\JoinColumn(nullable: false)]
private ?SchoolYear $year = null;
#[ORM\ManyToOne(inversedBy: 'primaryParentNotes')]
#[ORM\JoinColumn(nullable: false)]
private ?TheClass $classe = null;
#[ORM\OneToMany(mappedBy: 'parentNote', targetEntity: PrimaryNote::class)]
private Collection $primaryNotes;
public function __construct()
{
$this->primaryNotes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getPoint(): ?float
{
return $this->point;
}
public function setPoint(float $point): static
{
$this->point = $point;
return $this;
}
public function getSubject(): ?Subject
{
return $this->subject;
}
public function setSubject(Subject $subject): static
{
$this->subject = $subject;
return $this;
}
public function getSchool(): ?School
{
return $this->school;
}
public function setSchool(?School $school): static
{
$this->school = $school;
return $this;
}
public function getYear(): ?SchoolYear
{
return $this->year;
}
public function setYear(?SchoolYear $year): static
{
$this->year = $year;
return $this;
}
public function getClasse(): ?TheClass
{
return $this->classe;
}
public function setClasse(?TheClass $classe): static
{
$this->classe = $classe;
return $this;
}
/**
* @return Collection<int, PrimaryNote>
*/
public function getPrimaryNotes(): Collection
{
return $this->primaryNotes;
}
public function addPrimaryNote(PrimaryNote $primaryNote): static
{
if (!$this->primaryNotes->contains($primaryNote)) {
$this->primaryNotes->add($primaryNote);
$primaryNote->setParentNote($this);
}
return $this;
}
public function removePrimaryNote(PrimaryNote $primaryNote): static
{
if ($this->primaryNotes->removeElement($primaryNote)) {
// set the owning side to null (unless already changed)
if ($primaryNote->getParentNote() === $this) {
$primaryNote->setParentNote(null);
}
}
return $this;
}
}