src/Entity/Reclamation.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ReclamationRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ReclamationRepository::class)
  10.  * @UniqueEntity(
  11.  * fields= {"commande"},
  12.  * message= "Vous avez déjà fait une reclamation sur cette commande"
  13.  * )
  14.  * @UniqueEntity(
  15.  * fields= {"proposition"},
  16.  * message= "Vous avez déjà fait une reclamation sur cette proposition"
  17.  * )
  18.  */
  19. class Reclamation
  20. {
  21.     /**
  22.      * @ORM\Id
  23.      * @ORM\GeneratedValue
  24.      * @ORM\Column(type="integer")
  25.      */
  26.     private $id;
  27.     /**
  28.      * @ORM\Column(type="datetime")
  29.      */
  30.     private $creted_at;
  31.     /**
  32.      * @ORM\Column(type="datetime", nullable=true)
  33.      */
  34.     private $updated_at;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity=Discution::class, mappedBy="reclamation")
  37.      */
  38.     private $discutions;
  39.     /**
  40.      * @ORM\ManyToOne(targetEntity=TypeReclamation::class, inversedBy="reclamations")
  41.      * @ORM\JoinColumn(nullable=false)
  42.      */
  43.     private $typereclamation;
  44.     /**
  45.      * @ORM\ManyToOne(targetEntity=Proposition::class, inversedBy="reclamations")
  46.      */
  47.     private $proposition;
  48.     /**
  49.      * @ORM\ManyToOne(targetEntity=EtatReclamation::class, inversedBy="reclamations")
  50.      * @ORM\JoinColumn(nullable=false)
  51.      */
  52.     private $etatreclamation;
  53.     /**
  54.      * @ORM\OneToOne(targetEntity=Order::class)
  55.      */
  56.     private $commande;
  57.     /**
  58.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="reclamations")
  59.      * @ORM\JoinColumn(nullable=false)
  60.      */
  61.     private $user;
  62.     public function __construct()
  63.     {
  64.         $this->discutions = new ArrayCollection();
  65.         $this->creted_at = new \DateTime();
  66.     }
  67.     public function getId(): ?int
  68.     {
  69.         return $this->id;
  70.     }
  71.     public function getCretedAt(): ?\DateTimeInterface
  72.     {
  73.         return $this->creted_at;
  74.     }
  75.     public function setCretedAt(\DateTimeInterface $creted_at): self
  76.     {
  77.         $this->creted_at $creted_at;
  78.         return $this;
  79.     }
  80.     public function getUpdatedAt(): ?\DateTimeInterface
  81.     {
  82.         return $this->updated_at;
  83.     }
  84.     public function setUpdatedAt(?\DateTimeInterface $updated_at): self
  85.     {
  86.         $this->updated_at $updated_at;
  87.         return $this;
  88.     }
  89.     /**
  90.      * @return Collection<int, Discution>
  91.      */
  92.     public function getDiscutions(): Collection
  93.     {
  94.         return $this->discutions;
  95.     }
  96.     public function addDiscution(Discution $discution): self
  97.     {
  98.         if (!$this->discutions->contains($discution)) {
  99.             $this->discutions[] = $discution;
  100.             $discution->setReclamation($this);
  101.         }
  102.         return $this;
  103.     }
  104.     public function removeDiscution(Discution $discution): self
  105.     {
  106.         if ($this->discutions->removeElement($discution)) {
  107.             // set the owning side to null (unless already changed)
  108.             if ($discution->getReclamation() === $this) {
  109.                 $discution->setReclamation(null);
  110.             }
  111.         }
  112.         return $this;
  113.     }
  114.     public function getTypereclamation(): ?TypeReclamation
  115.     {
  116.         return $this->typereclamation;
  117.     }
  118.     public function setTypereclamation(?TypeReclamation $typereclamation): self
  119.     {
  120.         $this->typereclamation $typereclamation;
  121.         return $this;
  122.     }
  123.     public function getProposition(): ?Proposition
  124.     {
  125.         return $this->proposition;
  126.     }
  127.     public function setProposition(?Proposition $proposition): self
  128.     {
  129.         $this->proposition $proposition;
  130.         return $this;
  131.     }
  132.     public function getEtatreclamation(): ?EtatReclamation
  133.     {
  134.         return $this->etatreclamation;
  135.     }
  136.     public function setEtatreclamation(?EtatReclamation $etatreclamation): self
  137.     {
  138.         $this->etatreclamation $etatreclamation;
  139.         return $this;
  140.     }
  141.     public function getCommande(): ?Order
  142.     {
  143.         return $this->commande;
  144.     }
  145.     public function setCommande(?Order $commande): self
  146.     {
  147.         $this->commande $commande;
  148.         return $this;
  149.     }
  150.     public function getUser(): ?User
  151.     {
  152.         return $this->user;
  153.     }
  154.     public function setUser(?User $user): self
  155.     {
  156.         $this->user $user;
  157.         return $this;
  158.     }
  159. }