ninenote/src/ninenote-1.0/src/Entity/Year.php

315 lines
6.8 KiB
PHP

<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* Year
*
* @ORM\Entity(repositoryClass="App\Repository\YearRepository")
* @ORM\Table(name="year")
*/
class Year
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(name="name", type="string")
*
*/
private $name;
/**
* @ORM\Column(type="integer")
*/
private $yearof;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $datestart;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateend;
/**
* @ORM\OneToMany(targetEntity="Student", mappedBy="year")
*/
private $students;
/**
* @ORM\OneToMany(targetEntity="Teacher", mappedBy="year")
*/
private $teachers;
/**
* @ORM\OneToMany(targetEntity="Responsible", mappedBy="year")
*/
private $responsibles;
/**
* @ORM\OneToMany(targetEntity="Classroom", mappedBy="year")
*/
private $classrooms;
/**
* @ORM\OneToMany(targetEntity="Period", mappedBy="year")
*/
private $periods;
/**
* @ORM\OneToMany(targetEntity="Matter", mappedBy="year")
*/
private $matters;
public function __construct()
{
$this->students = new ArrayCollection();
$this->teachers = new ArrayCollection();
$this->classrooms = new ArrayCollection();
$this->matters = new ArrayCollection();
$this->responsibles = new ArrayCollection();
$this->periods = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getYearof(): ?int
{
return $this->yearof;
}
public function setYearof(int $yearof): self
{
$this->yearof = $yearof;
return $this;
}
public function getDatestart(): ?\DateTimeInterface
{
return $this->datestart;
}
public function setDatestart(?\DateTimeInterface $datestart): self
{
$this->datestart = $datestart;
return $this;
}
public function getDateend(): ?\DateTimeInterface
{
return $this->dateend;
}
public function setDateend(?\DateTimeInterface $dateend): self
{
$this->dateend = $dateend;
return $this;
}
/**
* @return Collection|Student[]
*/
public function getStudents(): Collection
{
return $this->students;
}
public function addStudent(Student $student): self
{
if (!$this->students->contains($student)) {
$this->students[] = $student;
$student->addYear($this);
}
return $this;
}
public function removeStudent(Student $student): self
{
if ($this->students->contains($student)) {
$this->students->removeElement($student);
$student->removeYear($this);
}
return $this;
}
/**
* @return Collection|Teacher[]
*/
public function getTeachers(): Collection
{
return $this->teachers;
}
public function addTeacher(Teacher $teacher): self
{
if (!$this->teachers->contains($teacher)) {
$this->teachers[] = $teacher;
$teacher->addYear($this);
}
return $this;
}
public function removeTeacher(Teacher $teacher): self
{
if ($this->teachers->contains($teacher)) {
$this->teachers->removeElement($teacher);
$teacher->removeYear($this);
}
return $this;
}
/**
* @return Collection|Classroom[]
*/
public function getClassrooms(): Collection
{
return $this->classrooms;
}
public function addClassroom(Classroom $classroom): self
{
if (!$this->classrooms->contains($classroom)) {
$this->classrooms[] = $classroom;
$classroom->addYear($this);
}
return $this;
}
public function removeClassroom(Classroom $classroom): self
{
if ($this->classrooms->contains($classroom)) {
$this->classrooms->removeElement($classroom);
$classroom->removeYear($this);
}
return $this;
}
/**
* @return Collection|Matter[]
*/
public function getMatters(): Collection
{
return $this->matters;
}
public function addMatter(Matter $matter): self
{
if (!$this->matters->contains($matter)) {
$this->matters[] = $matter;
$matter->addYear($this);
}
return $this;
}
public function removeMatter(Matter $matter): self
{
if ($this->matters->contains($matter)) {
$this->matters->removeElement($matter);
$matter->removeYear($this);
}
return $this;
}
/**
* @return Collection|Responsible[]
*/
public function getResponsibles(): Collection
{
return $this->responsibles;
}
public function addResponsible(Responsible $responsible): self
{
if (!$this->responsibles->contains($responsible)) {
$this->responsibles[] = $responsible;
$responsible->setYear($this);
}
return $this;
}
public function removeResponsible(Responsible $responsible): self
{
if ($this->responsibles->contains($responsible)) {
$this->responsibles->removeElement($responsible);
// set the owning side to null (unless already changed)
if ($responsible->getYear() === $this) {
$responsible->setYear(null);
}
}
return $this;
}
/**
* @return Collection|Period[]
*/
public function getPeriods(): Collection
{
return $this->periods;
}
public function addPeriod(Period $period): self
{
if (!$this->periods->contains($period)) {
$this->periods[] = $period;
$period->setYear($this);
}
return $this;
}
public function removePeriod(Period $period): self
{
if ($this->periods->contains($period)) {
$this->periods->removeElement($period);
// set the owning side to null (unless already changed)
if ($period->getYear() === $this) {
$period->setYear(null);
}
}
return $this;
}
}