src/Entity/Attribution.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Course;
  4. use App\Entity\User;
  5. use App\Entity\SchoolYear;
  6. use App\Repository\AttributionRepository;
  7. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10. * Attribution
  11. *
  12. * @ORM\Table(name="attribution")
  13. * @ORM\Entity(repositoryClass=AttributionRepository::class)
  14. * @UniqueEntity(fields={"course", "schoolYear"}, message= "There is already an attribution othe this course to this teacher at this year")
  15. */
  16. class Attribution {
  17. /**
  18. * @var int
  19. *
  20. * @ORM\Column(name="id", type="integer")
  21. * @ORM\Id
  22. * @ORM\GeneratedValue(strategy="AUTO")
  23. */
  24. private $id;
  25. //put your code here
  26. /**
  27. * @ORM\ManyToOne(targetEntity=Course::class,inversedBy="attributions")
  28. * @ORM\JoinColumn(name="course_id", referencedColumnName="id", nullable=false)
  29. */
  30. private $course;
  31. /**
  32. * @ORM\ManyToOne(targetEntity=User::class,inversedBy="attributions")
  33. * @ORM\JoinColumn(name="teacher_id", referencedColumnName="id", nullable=false)
  34. */
  35. private $teacher;
  36. /**
  37. * @ORM\ManyToOne(targetEntity=SchoolYear::class)
  38. * @ORM\JoinColumn(name="year_id", referencedColumnName="id", nullable=false)
  39. */
  40. private $schoolYear;
  41. /**
  42. * @var boolean
  43. *
  44. * @ORM\Column(name="head_teacher", type="boolean", options={"default":false})
  45. */
  46. private $headTeacher = false;
  47. public function setHeadTeacher($headTeacher)
  48. {
  49. $this->headTeacher = $headTeacher;
  50. return $this;
  51. }
  52. /**
  53. * Get enrolled
  54. *
  55. * @return boolean
  56. */
  57. public function getHeadTeacher()
  58. {
  59. return $this->headTeacher;
  60. }
  61. public function setTeacher(User $teacher)
  62. {
  63. $this->teacher = $teacher;
  64. return $this;
  65. }
  66. public function getTeacher()
  67. {
  68. return $this->teacher;
  69. }
  70. /**
  71. * Get id
  72. *
  73. * @return integer
  74. */
  75. public function getId()
  76. {
  77. return $this->id;
  78. }
  79. public function setSchoolYear(SchoolYear $schoolYear)
  80. {
  81. $this->schoolYear = $schoolYear;
  82. return $this;
  83. }
  84. public function getSchoolYear()
  85. {
  86. return $this->schoolYear;
  87. }
  88. public function setCourse(Course $course)
  89. {
  90. $this->course = $course;
  91. return $this;
  92. }
  93. public function getCourse()
  94. {
  95. return $this->course;
  96. }
  97. public function isHeadTeacher(): ?bool
  98. {
  99. return $this->headTeacher;
  100. }
  101. }