src/Entity/Training/Notemodule.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Training;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\Training\NotemoduleRepository;
  5. use App\Traits\Actions;
  6. use App\Entity\Training\Groupe;
  7. use App\Entity\Training\Module;
  8. use App\Entity\Training\Noteassign;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. #[ORM\Entity(repositoryClassNotemoduleRepository::class)]
  12. #[ORM\Table(name'hs_tc_training_notemodule')]
  13. #[ApiResource]
  14. class Notemodule
  15. {
  16.     use Actions;
  17.     #[ORM\Column(name"name"type"string"length255)]
  18.     private string $name;
  19.     #[ORM\ManyToOne(targetEntityModule::class, inversedBy"notes")]
  20.     #[ORM\JoinColumn(nullablefalse)]
  21.     private Module $module;
  22.     #[ORM\Column(name"genre"type"string"length255)]
  23.     private string $genre;
  24.     #[ORM\OneToMany(mappedBy"notemodule"targetEntity"Noteassign"cascade: ["persist"], orphanRemovaltrue)]
  25.     private Collection $lines;
  26.     #[ORM\Column(type'boolean')]
  27.     private $deleted;
  28.     public function __construct()
  29.     {
  30.         // date_default_timezone_set('Africa/Casablanca');
  31.         $this->createAt=new \DateTime('now');
  32.         $this->published=false;
  33.     }
  34.     /**
  35.      * @return Module
  36.      */
  37.     public function getModule(): ?Module
  38.     {
  39.         return $this->module;
  40.     }
  41.     /**
  42.      * @param Module $module
  43.      */
  44.     public function setModule(?Module $module): Notemodule
  45.     {
  46.         $this->module $module;
  47.         return $this;
  48.     }
  49.     /**
  50.      * @return string
  51.      */
  52.     public function getGenre(): ?string
  53.     {
  54.         return $this->genre;
  55.     }
  56.     /**
  57.      * @param string $genre
  58.      */
  59.     public function setGenre(?string $genre): Notemodule
  60.     {
  61.         $this->genre $genre;
  62.         return $this;
  63.     }
  64.     /**
  65.      * @return string
  66.      */
  67.     public function getName(): ?string
  68.     {
  69.         return $this->name;
  70.     }
  71.     /**
  72.      * @param string $name
  73.      */
  74.     public function setName(?string $name): Notemodule
  75.     {
  76.         $this->name $name;
  77.         return $this;
  78.     }
  79.     /**
  80.      * Add line
  81.      *
  82.      *
  83.      * @return Notemodule
  84.      */
  85.     public function addLine(Noteassign $line)
  86.     {
  87.         $line->setNotemodule($this);
  88.         $this->lines[] = $line;
  89.         return $this;
  90.     }
  91.     /**
  92.      * Remove line
  93.      */
  94.     public function removeLine(Noteassign $line)
  95.     {
  96.         $this->lines->removeElement($line);
  97.     }
  98.     /**
  99.      * Get lines
  100.      *
  101.      * @return Collection
  102.      */
  103.     public function getLines()
  104.     {
  105.         return $this->lines;
  106.     }
  107.     public function getNameTxt(){
  108.         $choices=[
  109.             'c1'=>'Contrôle 1',
  110.             'c2'=>'Contrôle 2',
  111.             'c3'=>'Contrôle 3',
  112.             'c4'=>'Contrôle 4',
  113.             /*            'c5'=>'Contrôle 5',*/
  114.             'ep'=>'Examen pratique',
  115.             'et'=>'Examen théorique',
  116.         ];
  117.         return$choices[$this->name];
  118.     }
  119.     /**
  120.      * @return bool
  121.      */
  122.     public function isDeleted()
  123.     {
  124.         return $this->deleted;
  125.     }
  126.     /**
  127.      * @param bool $deleted
  128.      */
  129.     public function setDeleted($deleted)
  130.     {
  131.         $this->deleted $deleted;
  132.     }
  133. }