src/Entity/Proposition.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PropositionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=PropositionRepository::class)
  9.  */
  10. class Proposition
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="datetime")
  20.      */
  21.     private $createdAt;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="propositions")
  24.      * @ORM\JoinColumn(nullable=false)
  25.      */
  26.     private $user;
  27.     /**
  28.      * @ORM\OneToMany(targetEntity=PropositionDetails::class, mappedBy="proposition")
  29.      * @ORM\JoinColumn(onDelete="CASCADE")
  30.      */
  31.     private $propositionDetails;
  32.     /**
  33.      * @ORM\ManyToOne(targetEntity=PropositionStatus::class, inversedBy="propositions")
  34.      */
  35.     private $statut;
  36.     /**
  37.      * @ORM\OneToMany(targetEntity=Suggestion::class, mappedBy="proposition")
  38.      */
  39.     private $suggestions;
  40.     /**
  41.      * @ORM\OneToMany(targetEntity=Reclamation::class, mappedBy="proposition")
  42.      */
  43.     private $reclamations;
  44.     /**
  45.      * @ORM\Column(type="boolean", nullable=true)
  46.      */
  47.     private $is_parmois;
  48.     public function __construct()
  49.     {
  50.         $this->createdAt = new \DateTime();
  51.         $this->propositionDetails = new ArrayCollection();
  52.         $this->suggestions = new ArrayCollection();
  53.         $this->reclamations = new ArrayCollection();
  54.     }
  55.     const TYPES = [
  56.         'Moin sur' => 'Moin sur',
  57.         'Sur' => 'Sur'
  58.     ];
  59.     public function getPrescriptionType()
  60.     {
  61.         return self::TYPES[$this->prescription];
  62.     }
  63.     
  64.     public function getId(): ?int
  65.     {
  66.         return $this->id;
  67.     }
  68.     public function getCreatedAt(): ?\DateTimeInterface
  69.     {
  70.         return $this->createdAt;
  71.     }
  72.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  73.     {
  74.         $this->createdAt $createdAt;
  75.         return $this;
  76.     }
  77.     public function getUser(): ?User
  78.     {
  79.         return $this->user;
  80.     }
  81.     public function setUser(?User $user): self
  82.     {
  83.         $this->user $user;
  84.         return $this;
  85.     }
  86.     /**
  87.      * @return Collection<int, PropositionDetails>
  88.      */
  89.     public function getPropositionDetails(): Collection
  90.     {
  91.         return $this->propositionDetails;
  92.     }
  93.     public function addPropositionDetail(PropositionDetails $propositionDetail): self
  94.     {
  95.         if (!$this->propositionDetails->contains($propositionDetail)) {
  96.             $this->propositionDetails[] = $propositionDetail;
  97.             $propositionDetail->setProposition($this);
  98.         }
  99.         return $this;
  100.     }
  101.     public function removePropositionDetail(PropositionDetails $propositionDetail): self
  102.     {
  103.         if ($this->propositionDetails->removeElement($propositionDetail)) {
  104.             // set the owning side to null (unless already changed)
  105.             if ($propositionDetail->getProposition() === $this) {
  106.                 $propositionDetail->setProposition(null);
  107.             }
  108.         }
  109.         return $this;
  110.     }
  111.     public function getStatut(): ?PropositionStatus
  112.     {
  113.         return $this->statut;
  114.     }
  115.     public function setStatut(?PropositionStatus $statut): self
  116.     {
  117.         $this->statut $statut;
  118.         return $this;
  119.     }
  120.     /**
  121.      * @return Collection<int, Suggestion>
  122.      */
  123.     public function getSuggestions(): Collection
  124.     {
  125.         return $this->suggestions;
  126.     }
  127.     public function addSuggestion(Suggestion $suggestion): self
  128.     {
  129.         if (!$this->suggestions->contains($suggestion)) {
  130.             $this->suggestions[] = $suggestion;
  131.             $suggestion->setProposition($this);
  132.         }
  133.         return $this;
  134.     }
  135.     public function removeSuggestion(Suggestion $suggestion): self
  136.     {
  137.         if ($this->suggestions->removeElement($suggestion)) {
  138.             // set the owning side to null (unless already changed)
  139.             if ($suggestion->getProposition() === $this) {
  140.                 $suggestion->setProposition(null);
  141.             }
  142.         }
  143.         return $this;
  144.     }
  145.     /**
  146.      * @return Collection<int, Reclamation>
  147.      */
  148.     public function getReclamations(): Collection
  149.     {
  150.         return $this->reclamations;
  151.     }
  152.     public function addReclamation(Reclamation $reclamation): self
  153.     {
  154.         if (!$this->reclamations->contains($reclamation)) {
  155.             $this->reclamations[] = $reclamation;
  156.             $reclamation->setProposition($this);
  157.         }
  158.         return $this;
  159.     }
  160.     public function removeReclamation(Reclamation $reclamation): self
  161.     {
  162.         if ($this->reclamations->removeElement($reclamation)) {
  163.             // set the owning side to null (unless already changed)
  164.             if ($reclamation->getProposition() === $this) {
  165.                 $reclamation->setProposition(null);
  166.             }
  167.         }
  168.         return $this;
  169.     }
  170.     public function isIsParmois(): ?bool
  171.     {
  172.         return $this->is_parmois;
  173.     }
  174.     public function setIsParmois(?bool $is_parmois): self
  175.     {
  176.         $this->is_parmois $is_parmois;
  177.         return $this;
  178.     }
  179. }