src/Entity/ActiviteDisponibiliteInscription.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ActiviteDisponibiliteInscriptionRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=ActiviteDisponibiliteInscriptionRepository::class)
  7.  */
  8. class ActiviteDisponibiliteInscription
  9. {
  10.     /**
  11.      * @ORM\Id
  12.      * @ORM\GeneratedValue
  13.      * @ORM\Column(type="integer")
  14.      */
  15.     private $id;
  16.     /**
  17.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="activiteDisponibiliteInscriptions")
  18.      * @ORM\JoinColumn(nullable=false)
  19.      */
  20.     private $user;
  21.     /**
  22.      * @ORM\ManyToOne(targetEntity=ActiviteDisponibilite::class, inversedBy="activiteDisponibiliteInscriptions")
  23.      * @ORM\JoinColumn(nullable=false)
  24.      */
  25.     private $dispo;
  26.     /**
  27.      * @ORM\OneToOne(targetEntity=UserEleveCreditConsommation::class, mappedBy="utilisation_cours", cascade={"persist", "remove"})
  28.      */
  29.     private $userEleveCreditConsommation;
  30.     /**
  31.      * @ORM\ManyToOne(targetEntity=UserEnseignantLieu::class, inversedBy="activiteDisponibiliteInscriptions")
  32.      */
  33.     private $lieu;
  34.     /**
  35.      * @ORM\Column(type="text", nullable=true)
  36.      */
  37.     private $commentaire;
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity=UserEnseignantFacture::class, inversedBy="cours")
  40.      * @ORM\JoinColumn(onDelete="SET NULL")
  41.      */
  42.     private $facture;
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getUser(): ?User
  48.     {
  49.         return $this->user;
  50.     }
  51.     public function setUser(?User $user): self
  52.     {
  53.         $this->user $user;
  54.         return $this;
  55.     }
  56.     public function getDispo(): ?ActiviteDisponibilite
  57.     {
  58.         return $this->dispo;
  59.     }
  60.     public function setDispo(?ActiviteDisponibilite $dispo): self
  61.     {
  62.         $this->dispo $dispo;
  63.         return $this;
  64.     }
  65.     public function getUserEleveCreditConsommation(): ?UserEleveCreditConsommation
  66.     {
  67.         return $this->userEleveCreditConsommation;
  68.     }
  69.     public function setUserEleveCreditConsommation(?UserEleveCreditConsommation $userEleveCreditConsommation): self
  70.     {
  71.         $this->userEleveCreditConsommation $userEleveCreditConsommation;
  72.         return $this;
  73.     }
  74.     public function getHoursLeft(): int {
  75.         $start $this->getDispo()->getDebut()->getTimestamp();
  76.         $now time();
  77.         $interval $start $now;
  78.         $seconds $interval;
  79.         $hours $seconds/(60*60);
  80.         return $hours;
  81.     }
  82.     public function getLieu(): ?UserEnseignantLieu
  83.     {
  84.         return $this->lieu;
  85.     }
  86.     public function setLieu(?UserEnseignantLieu $lieu): self
  87.     {
  88.         $this->lieu $lieu;
  89.         return $this;
  90.     }
  91.     public function getCommentaire(): ?string
  92.     {
  93.         return $this->commentaire;
  94.     }
  95.     public function setCommentaire(?string $commentaire): self
  96.     {
  97.         $this->commentaire $commentaire;
  98.         return $this;
  99.     }
  100.     public function getLivret(): ?Livret
  101.     {
  102.         $estimations $this->getUser()->getEstimations();
  103.         if($estimations->count()==0)return null;
  104.         $livrets $this->getDispo()->getCategorie()->getLivrets()->filter(function($element) use($estimations) {
  105.             return $estimations->contains($element->getEstimations());
  106.         });
  107.         if($livrets->count()!=1)return null;
  108.         return $livrets->first();
  109.     }
  110.     public function getFacture(): ?UserEnseignantFacture
  111.     {
  112.         return $this->facture;
  113.     }
  114.     public function setFacture(?UserEnseignantFacture $facture): self
  115.     {
  116.         $this->facture $facture;
  117.         return $this;
  118.     }
  119. }