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.     /**
  28.      * @ORM\ManyToOne(targetEntity=Course::class)
  29.      * @ORM\JoinColumn(name="course_id", referencedColumnName="id", nullable=false)
  30.      */
  31.     private $course;
  32.     
  33.      /**
  34.      * @ORM\ManyToOne(targetEntity=User::class)
  35.      * @ORM\JoinColumn(name="teacher_id", referencedColumnName="id", nullable=false)
  36.      */
  37.     private $teacher;
  38.       /**
  39.      * @ORM\ManyToOne(targetEntity=SchoolYear::class)
  40.      * @ORM\JoinColumn(name="year_id", referencedColumnName="id", nullable=false)
  41.      */
  42.     private $schoolYear;
  43.      /**
  44.      * @var boolean
  45.      *
  46.      * @ORM\Column(name="head_teacher", type="boolean", options={"default":false})
  47.      */
  48.     private $headTeacher false;
  49.     
  50.     public function setHeadTeacher($headTeacher)
  51.     {
  52.         $this->headTeacher $headTeacher;
  53.         return $this;
  54.     }
  55.     /**
  56.      * Get enrolled
  57.      *
  58.      * @return boolean
  59.      */
  60.     public function getHeadTeacher()
  61.     {
  62.         return $this->headTeacher;
  63.     }
  64.    
  65.     public function setTeacher(User $teacher)
  66.     {
  67.         $this->teacher $teacher;
  68.         return $this;
  69.     }
  70.    
  71.     public function getTeacher()
  72.     {
  73.         return $this->teacher;
  74.     }
  75.     /**
  76.      * Get id
  77.      *
  78.      * @return integer
  79.      */
  80.     public function getId()
  81.     {
  82.         return $this->id;
  83.     }
  84.     
  85.     public function setSchoolYear(SchoolYear $schoolYear)
  86.     {
  87.         $this->schoolYear $schoolYear;
  88.         return $this;
  89.     }
  90.     
  91.     public function getSchoolYear()
  92.     {
  93.         return $this->schoolYear;
  94.     }
  95.   
  96.     public function setCourse(Course $course)
  97.     {
  98.         $this->course $course;
  99.         return $this;
  100.     }
  101.     public function getCourse()
  102.     {
  103.         return $this->course;
  104.     }
  105.     public function isHeadTeacher(): ?bool
  106.     {
  107.         return $this->headTeacher;
  108.     }
  109. }