src/Entity/SchoolTeacherCallSheet.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SchoolTeacherCallSheetRepository;
  4. use App\Repository\UserRepository;
  5. use DateTimeImmutable;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10.  * @ORM\Entity(repositoryClass=SchoolTeacherCallSheetRepository::class)
  11.  * SchoolTeacherTimeSheet
  12.  */
  13. class SchoolTeacherCallSheet
  14. {
  15.     const STATUS_BROUILLON 'Brouillon';
  16.     const STATUS_VALIDE 'Validé';
  17.     const STATUS_REJETE 'Rejeté';
  18.     /**
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue
  21.      * @ORM\Column(type="integer")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @ORM\ManyToOne(targetEntity=Establishment::class, inversedBy="schoolTeacherCallSheets")
  26.      * @ORM\JoinColumn(nullable=false)
  27.      */
  28.     private $establishment;
  29.     /**
  30.      * @ORM\ManyToOne(targetEntity=SchoolYear::class, inversedBy="schoolTeacherCallSheets")
  31.      * @ORM\JoinColumn(nullable=false)
  32.      */
  33.     private $schoolYear;
  34.     /**
  35.      * @ORM\ManyToOne(targetEntity=SettingClassroom::class, inversedBy="schoolTeacherCallSheets")
  36.      * @ORM\JoinColumn(nullable=false)
  37.      */
  38.     private $settingClassroom;
  39.     /**
  40.      * @ORM\ManyToOne(targetEntity=SchoolWorkingTime::class, inversedBy="schoolTeacherCallSheets")
  41.      */
  42.     private $schoolWorkingTime;
  43.     /**
  44.      * @ORM\ManyToOne(targetEntity=SettingTimeTable::class, inversedBy="schoolTeacherCallSheets")
  45.      */
  46.     private $settingTimeTable;
  47.     /**
  48.      * @ORM\ManyToOne(targetEntity=SchoolMatter::class, inversedBy="schoolTeacherCallSheets")
  49.      */
  50.     private $schoolMatter;
  51.     /**
  52.      * @ORM\ManyToOne(targetEntity=SchoolTeacher::class, inversedBy="schoolTeacherCallSheets")
  53.      */
  54.     private $schoolTeacher;
  55.     /**
  56.      * @ORM\Column(type="string", length=60)
  57.     */
  58.     private $day;
  59.     /**
  60.      * @ORM\Column(type="date_immutable")
  61.      */
  62.     private $create_date;
  63.     /**
  64.      * @ORM\Column(type="string", length=60)
  65.     */
  66.     private $create_time;
  67.     /**
  68.      * @ORM\Column(type="datetime_immutable")
  69.      */
  70.     private $created_at;
  71.     /**
  72.      * @ORM\Column(type="datetime_immutable")
  73.      */
  74.     private $updated_at;
  75.     /**
  76.      * @ORM\Column(type="integer")
  77.      */
  78.     private $created_by;
  79.     /**
  80.      * @ORM\Column(type="integer")
  81.      */
  82.     private $updated_by;
  83.     /**
  84.      * @ORM\OneToMany(targetEntity=SchoolTeacherCallSheetLine::class, mappedBy="schoolTeacherCallSheet")
  85.      */
  86.     private $schoolTeacherCallSheetLines;
  87.     /**
  88.      * @ORM\Column(type="boolean")
  89.      */
  90.     private $is_validated;
  91.     /**
  92.      * @ORM\Column(type="boolean")
  93.      */
  94.     private $is_aproved;
  95.     /**
  96.      * @ORM\OneToMany(targetEntity=SchoolTeacherTimeSheet::class, mappedBy="schoolTeacherCallSheet")
  97.      */
  98.     private $schoolTeacherTimeSheets;
  99.     /**
  100.      * @ORM\Column(type="float", nullable=true)
  101.      */
  102.     private $defaut_duration;
  103.     /**
  104.      * @ORM\Column(type="string", length=50)
  105.      */
  106.     private $status;
  107.     /**
  108.      * @ORM\Column(type="text", nullable=true)
  109.      */
  110.     private $rejectionReason;
  111.     public function __construct()
  112.     {
  113.         $this->schoolTeacherCallSheetLines = new ArrayCollection();
  114.         $this->create_date = new DateTimeImmutable();
  115.         $this->is_validated false;
  116.         $this->is_aproved false;
  117.         $this->schoolTeacherTimeSheets = new ArrayCollection();
  118.         $this->status self::STATUS_BROUILLON;
  119.     }
  120.     public function getId(): ?int
  121.     {
  122.         return $this->id;
  123.     }
  124.     public function getEstablishment(): ?Establishment
  125.     {
  126.         return $this->establishment;
  127.     }
  128.     public function setEstablishment(?Establishment $establishment): self
  129.     {
  130.         $this->establishment $establishment;
  131.         return $this;
  132.     }
  133.     public function getSchoolYear(): ?SchoolYear
  134.     {
  135.         return $this->schoolYear;
  136.     }
  137.     public function setSchoolYear(?SchoolYear $schoolYear): self
  138.     {
  139.         $this->schoolYear $schoolYear;
  140.         return $this;
  141.     }
  142.     public function getSettingClassroom(): ?SettingClassroom
  143.     {
  144.         return $this->settingClassroom;
  145.     }
  146.     public function setSettingClassroom(?SettingClassroom $settingClassroom): self
  147.     {
  148.         $this->settingClassroom $settingClassroom;
  149.         return $this;
  150.     }
  151.     public function getSchoolWorkingTime(): ?SchoolWorkingTime
  152.     {
  153.         return $this->schoolWorkingTime;
  154.     }
  155.     public function setSchoolWorkingTime(?SchoolWorkingTime $schoolWorkingTime): self
  156.     {
  157.         $this->schoolWorkingTime $schoolWorkingTime;
  158.         return $this;
  159.     }
  160.     public function getSettingTimeTable(): ?SettingTimeTable
  161.     {
  162.         return $this->settingTimeTable;
  163.     }
  164.     public function setSettingTimeTable(?SettingTimeTable $settingTimeTable): self
  165.     {
  166.         $this->settingTimeTable $settingTimeTable;
  167.         return $this;
  168.     }
  169.     public function getSchoolMatter(): ?SchoolMatter
  170.     {
  171.         return $this->schoolMatter;
  172.     }
  173.     public function setSchoolMatter(?SchoolMatter $schoolMatter): self
  174.     {
  175.         $this->schoolMatter $schoolMatter;
  176.         return $this;
  177.     }
  178.     public function getSchoolTeacher(): ?SchoolTeacher
  179.     {
  180.         return $this->schoolTeacher;
  181.     }
  182.     public function setSchoolTeacher(?SchoolTeacher $schoolTeacher): self
  183.     {
  184.         $this->schoolTeacher $schoolTeacher;
  185.         return $this;
  186.     }
  187.     public function getDay(): ?string
  188.     {
  189.         return $this->day;
  190.     }
  191.     public function setDay(string $day): self
  192.     {
  193.         $this->day $day;
  194.         return $this;
  195.     }
  196.     public function getCreateDate(): ?\DateTimeImmutable
  197.     {
  198.         return $this->create_date;
  199.     }
  200.     public function setCreateDate(\DateTimeImmutable $create_date): self
  201.     {
  202.         $this->create_date $create_date;
  203.         return $this;
  204.     }
  205.     public function getCreateTime(): ?string
  206.     {
  207.         return $this->create_time;
  208.     }
  209.     public function setCreateTime(string $create_time): self
  210.     {
  211.         $this->create_time $create_time;
  212.         return $this;
  213.     }
  214.     public function getCreatedAt(): ?\DateTimeImmutable
  215.     {
  216.         return $this->created_at;
  217.     }
  218.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  219.     {
  220.         $this->created_at $created_at;
  221.         return $this;
  222.     }
  223.     public function getUpdatedAt(): ?\DateTimeImmutable
  224.     {
  225.         return $this->updated_at;
  226.     }
  227.     public function setUpdatedAt(\DateTimeImmutable $updated_at): self
  228.     {
  229.         $this->updated_at $updated_at;
  230.         return $this;
  231.     }
  232.     public function getCreatedBy(): ?int
  233.     {
  234.         return $this->created_by;
  235.     }
  236.     public function setCreatedBy(int $created_by): self
  237.     {
  238.         $this->created_by $created_by;
  239.         return $this;
  240.     }
  241.     public function getUpdatedBy(): ?int
  242.     {
  243.         return $this->updated_by;
  244.     }
  245.     public function setUpdatedBy(int $updated_by): self
  246.     {
  247.         $this->updated_by $updated_by;
  248.         return $this;
  249.     }
  250.     /**
  251.      * @return Collection|SchoolTeacherCallSheetLine[]
  252.      */
  253.     public function getSchoolTeacherCallSheetLines(): Collection
  254.     {
  255.         return $this->schoolTeacherCallSheetLines;
  256.     }
  257.     public function addSchoolTeacherCallSheetLine(SchoolTeacherCallSheetLine $schoolTeacherCallSheetLine): self
  258.     {
  259.         if (!$this->schoolTeacherCallSheetLines->contains($schoolTeacherCallSheetLine)) {
  260.             $this->schoolTeacherCallSheetLines[] = $schoolTeacherCallSheetLine;
  261.             $schoolTeacherCallSheetLine->setSchoolTeacherCallSheet($this);
  262.         }
  263.         return $this;
  264.     }
  265.     public function removeSchoolTeacherCallSheetLine(SchoolTeacherCallSheetLine $schoolTeacherCallSheetLine): self
  266.     {
  267.         if ($this->schoolTeacherCallSheetLines->removeElement($schoolTeacherCallSheetLine)) {
  268.             // set the owning side to null (unless already changed)
  269.             if ($schoolTeacherCallSheetLine->getSchoolTeacherCallSheet() === $this) {
  270.                 $schoolTeacherCallSheetLine->setSchoolTeacherCallSheet(null);
  271.             }
  272.         }
  273.         return $this;
  274.     }
  275.     public function getIsValidated(): ?bool
  276.     {
  277.         return $this->is_validated;
  278.     }
  279.     public function setIsValidated(bool $is_validated): self
  280.     {
  281.         $this->is_validated $is_validated;
  282.         return $this;
  283.     }
  284.     public function isCanBeSaved(){
  285.         foreach ($this->getSchoolTeacherCallSheetLines() as $key => $schoolTeacherCallSheetLine) {
  286.             if (!$schoolTeacherCallSheetLine->getIsAbsent() && !$schoolTeacherCallSheetLine->getIsPresente()) {
  287.                 return false;
  288.             }
  289.         }
  290.         return true;
  291.     }
  292.     public function getIsAproved(): ?bool
  293.     {
  294.         return $this->is_aproved;
  295.     }
  296.     public function setIsAproved(bool $is_aproved): self
  297.     {
  298.         $this->is_aproved $is_aproved;
  299.         return $this;
  300.     }
  301.     /**
  302.      * @return Collection|SchoolTeacherTimeSheet[]
  303.      */
  304.     public function getSchoolTeacherTimeSheets(): Collection
  305.     {
  306.         return $this->schoolTeacherTimeSheets;
  307.     }
  308.     public function addSchoolTeacherTimeSheet(SchoolTeacherTimeSheet $schoolTeacherTimeSheet): self
  309.     {
  310.         if (!$this->schoolTeacherTimeSheets->contains($schoolTeacherTimeSheet)) {
  311.             $this->schoolTeacherTimeSheets[] = $schoolTeacherTimeSheet;
  312.             $schoolTeacherTimeSheet->setSchoolTeacherCallSheet($this);
  313.         }
  314.         return $this;
  315.     }
  316.     public function removeSchoolTeacherTimeSheet(SchoolTeacherTimeSheet $schoolTeacherTimeSheet): self
  317.     {
  318.         if ($this->schoolTeacherTimeSheets->removeElement($schoolTeacherTimeSheet)) {
  319.             // set the owning side to null (unless already changed)
  320.             if ($schoolTeacherTimeSheet->getSchoolTeacherCallSheet() === $this) {
  321.                 $schoolTeacherTimeSheet->setSchoolTeacherCallSheet(null);
  322.             }
  323.         }
  324.         return $this;
  325.     }
  326.     public function getDefautDuration(): ?float
  327.     {
  328.         return $this->defaut_duration;
  329.     }
  330.     public function setDefautDuration(?float $defaut_duration): self
  331.     {
  332.         $this->defaut_duration $defaut_duration;
  333.         return $this;
  334.     }
  335.     public function getStatus(): ?string
  336.     {
  337.         return $this->status;
  338.     }
  339.     public function setStatus(string $status): self
  340.     {
  341.         $this->status $status;
  342.         return $this;
  343.     }
  344.     public function getRejectionReason(): ?string
  345.     {
  346.         return $this->rejectionReason;
  347.     }
  348.     public function setRejectionReason(?string $rejectionReason): self
  349.     {
  350.         $this->rejectionReason $rejectionReason;
  351.         return $this;
  352.     }
  353.     public function getUser(UserRepository $userRepository){
  354.         return $userRepository->findOneBy(['id' => $this->getCreatedBy()], []);
  355.     }
  356.     public function getCreatedByUsername(UserRepository $userRepository): ?string
  357.     {
  358.         return $userRepository->findOneBy(['id' => $this->getCreatedBy()], []) ? $userRepository->findOneBy(['id' => $this->getCreatedBy()], [])->getUserIdentifier() : null;
  359.     }
  360.     public function getUpdatedByUsername(UserRepository $userRepository): ?string
  361.     {
  362.         return $userRepository->findOneBy(['id' => $this->getUpdatedBy()], []) ? $userRepository->findOneBy(['id' => $this->getUpdatedBy()], [])->getUserIdentifier() : null;
  363.     }
  364. }