src/Entity/LivretEstimation.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LivretEstimationRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Gedmo\Mapping\Annotation as Gedmo;
  6. /**
  7.  * @ORM\Entity(repositoryClass=LivretEstimationRepository::class)
  8.  * @ORM\HasLifecycleCallbacks
  9.  */
  10. class LivretEstimation
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $heures;
  22.     /**
  23.      * @ORM\Column(type="text")
  24.      */
  25.     private $commentaire;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=Livret::class, inversedBy="estimations")
  28.      * @ORM\JoinColumn(nullable=false)
  29.      */
  30.     private $livret;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="estimations")
  33.      * @ORM\JoinColumn(nullable=false)
  34.      */
  35.     private $eleve;
  36.     /**
  37.      * @ORM\Column(type="date")
  38.      * @Gedmo\Timestampable(on="create")
  39.      */
  40.     private $created;
  41.     /**
  42.      * @ORM\Column(type="date")
  43.      * @Gedmo\Timestampable(on="update")
  44.      */
  45.     private $updated;
  46.     /**
  47.      * @ORM\Column(type="date",nullable=true)
  48.      */
  49.     private $dateInscription;
  50.     /**
  51.      * @ORM\Column(type="text",nullable=true)
  52.      */
  53.     private $sousCategoriePermis;
  54.     public static $sousCategoriesPermis = [ 'A''A1''A2''B''BE''B1''C''CE''C1''C1E''D''DE''D1''D1E' ];
  55.     /**
  56.      * @ORM\Column(type="text",nullable=true)
  57.      */
  58.     private $typeVehicule;
  59.     public static $typesVehicules = ['MANUEL''AUTOMATIQUE'];
  60.     /**
  61.      * @ORM\Column(type="text",nullable=true)
  62.      */
  63.     private $typeFormation;
  64.     public static $typesFormations = ['AAC''TRADITIONNELLE''SUPERVISEE''ENCADREE'];
  65.     public function getId(): ?int
  66.     {
  67.         return $this->id;
  68.     }
  69.     public function getHeures(): ?int
  70.     {
  71.         return $this->heures;
  72.     }
  73.     public function setHeures(int $heures): self
  74.     {
  75.         $this->heures $heures;
  76.         return $this;
  77.     }
  78.     public function getCommentaire(): ?string
  79.     {
  80.         return $this->commentaire;
  81.     }
  82.     public function setCommentaire(string $commentaire): self
  83.     {
  84.         $this->commentaire $commentaire;
  85.         return $this;
  86.     }
  87.     public function getLivret(): ?Livret
  88.     {
  89.         return $this->livret;
  90.     }
  91.     public function setLivret(?Livret $livret): self
  92.     {
  93.         $this->livret $livret;
  94.         return $this;
  95.     }
  96.     public function getEleve(): ?User
  97.     {
  98.         return $this->eleve;
  99.     }
  100.     public function setEleve(?User $eleve): self
  101.     {
  102.         $this->eleve $eleve;
  103.         return $this;
  104.     }
  105.     public function getCreated(): ?\DateTimeInterface
  106.     {
  107.         return $this->created;
  108.     }
  109.     public function setCreated(\DateTimeInterface $created): self
  110.     {
  111.         $this->created $created;
  112.         return $this;
  113.     }
  114.     /**
  115.      * @ORM\PrePersist
  116.      */
  117.     public function makeCreated()
  118.     {
  119.         $this->created $this->dateInscription = new \DateTimeImmutable();
  120.     }
  121.     public function getUpdated(): ?\DateTimeInterface
  122.     {
  123.         return $this->updated;
  124.     }
  125.     public function setUpdated(\DateTimeInterface $updated): self
  126.     {
  127.         $this->updated $updated;
  128.         return $this;
  129.     }
  130.     public function getDateInscription(): ?\DateTimeInterface
  131.     {
  132.         return $this->dateInscription;
  133.     }
  134.     public function setDateInscription(\DateTimeInterface $inscription): self
  135.     {
  136.         $this->dateInscription $inscription;
  137.         return $this;
  138.     }
  139.     /**
  140.      * @ORM\PrePersist
  141.      * @ORM\PreUpdate
  142.      */
  143.     public function makeUpdated()
  144.     {
  145.         $this->updated = new \DateTimeImmutable();
  146.     }
  147.     public function getSousCategoriePermis(): ?string
  148.     {
  149.         return $this->sousCategoriePermis;
  150.     }
  151.     public function setSousCategoriePermis(?string $sousCategoriePermis): self
  152.     {
  153.         $this->sousCategoriePermis $sousCategoriePermis;
  154.         return $this;
  155.     }
  156.     /**
  157.      * @ORM\PrePersist
  158.      * @ORM\PreUpdate
  159.      */
  160.     public function testSousCategoriePermis()
  161.     {
  162.         if(empty($this->sousCategoriePermis)) return;
  163.         if (!in_array($this->sousCategoriePermisself::$sousCategoriesPermis)) {
  164.             throw new \UnexpectedValueException('sousCategoriePermis ('.$this->sousCategoriePermis.') expects one of: ' implode(', 'self::$sousCategoriesPermis));
  165.         }
  166.     }
  167.     public function getTypeVehicule(): ?string
  168.     {
  169.         return $this->typeVehicule;
  170.     }
  171.     public function setTypeVehicule(?string $typeVehicule): self
  172.     {
  173.         $this->typeVehicule $typeVehicule;
  174.         return $this;
  175.     }
  176.     /**
  177.      * @ORM\PrePersist
  178.      * @ORM\PreUpdate
  179.      */
  180.     public function testTypeVehicule()
  181.     {
  182.         if(empty($this->typeVehicule)) return;
  183.         if (!in_array($this->typeVehiculeself::$typesVehicules)) {
  184.             throw new \UnexpectedValueException('typeVehicule ('.$this->typeVehicule.') expects one of: ' implode(', 'self::$typesVehicules));
  185.         }
  186.     }
  187.     public function getTypeFormation(): ?string
  188.     {
  189.         return $this->typeFormation;
  190.     }
  191.     public function setTypeFormation(?string $typeFormation): self
  192.     {
  193.         $this->typeFormation $typeFormation;
  194.         return $this;
  195.     }
  196.     /**
  197.      * @ORM\PrePersist
  198.      * @ORM\PreUpdate
  199.      */
  200.     public function testTypeFormation()
  201.     {
  202.         if(empty($this->typeFormation)) return;
  203.         if (!in_array($this->typeFormationself::$typesFormations)) {
  204.             throw new \UnexpectedValueException('typeFormation ('.$this->typeFormation.') expects one of: ' implode(', 'self::$typesFormations));
  205.         }
  206.     }
  207. }