<?phpnamespace App\Entity;use App\Entity\Traits\Timestampable;use App\Repository\SubjectGroupRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\HasLifecycleCallbacks]#[ORM\Entity(repositoryClass: SubjectGroupRepository::class)]class SubjectGroup{ use Timestampable; #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255)] private ?string $name = null; #[ORM\OneToMany(mappedBy: 'subjectGroup', targetEntity: Subject::class)] private Collection $subjects; #[ORM\ManyToOne(inversedBy: 'subjectGroups', cascade: ["persist"])] #[ORM\JoinColumn(nullable: false)] private ?User $author = null; #[ORM\ManyToOne(inversedBy: 'subjectGroupsEdited', cascade: ["persist"])] private ?User $editor = null; #[ORM\ManyToOne(inversedBy: 'subjectGroups', cascade: ["persist"])] private ?School $school = null; #[ORM\ManyToOne(inversedBy: 'subjectGroups', cascade: ["persist"])] #[ORM\JoinColumn(nullable: false)] private ?TheClass $classe = null; public function __toString():string { return $this->name; } public function __construct() { $this->subjects = 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; } /** * @return Collection<int, Subject> */ public function getSubjects(): Collection { return $this->subjects; } public function addSubject(Subject $subject): static { if (!$this->subjects->contains($subject)) { $this->subjects->add($subject); $subject->setSubjectGroup($this); } return $this; } public function removeSubject(Subject $subject): static { if ($this->subjects->removeElement($subject)) { // set the owning side to null (unless already changed) if ($subject->getSubjectGroup() === $this) { $subject->setSubjectGroup(null); } } return $this; } public function getAuthor(): ?User { return $this->author; } public function setAuthor(?User $author): static { $this->author = $author; return $this; } public function getEditor(): ?User { return $this->editor; } public function setEditor(?User $editor): static { $this->editor = $editor; return $this; } public function getSchool(): ?School { return $this->school; } public function setSchool(?School $school): static { $this->school = $school; return $this; } public function getClasse(): ?TheClass { return $this->classe; } public function setClasse(?TheClass $classe): static { $this->classe = $classe; return $this; }}