src/Entity/Orders.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\OrdersRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=OrdersRepository::class)
  9.  */
  10. class Orders
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="orders")
  20.      */
  21.     private $user;
  22.     /**
  23.      * @ORM\Column(type="datetime")
  24.      */
  25.     private $date;
  26.     /**
  27.      * @ORM\Column(type="decimal", precision=10, scale=2)
  28.      */
  29.     private $total;
  30.     /**
  31.      * @ORM\Column(type="string", length=255)
  32.      */
  33.     private $numerocommande;
  34.     /**
  35.      * @ORM\Column(type="string", length=255)
  36.      */
  37.     private $status;
  38.     /**
  39.      * @ORM\OneToMany(targetEntity=Commission::class, mappedBy="orderid")
  40.      */
  41.     private $commissions;
  42.     public function __construct()
  43.     {
  44.         $this->commissions = new ArrayCollection();
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getUser(): ?User
  51.     {
  52.         return $this->user;
  53.     }
  54.     public function setUser(?User $user): self
  55.     {
  56.         $this->user $user;
  57.         return $this;
  58.     }
  59.     public function getDate(): ?\DateTimeInterface
  60.     {
  61.         return $this->date;
  62.     }
  63.     public function setDate(\DateTimeInterface $date): self
  64.     {
  65.         $this->date $date;
  66.         return $this;
  67.     }
  68.     public function getTotal(): ?string
  69.     {
  70.         return $this->total;
  71.     }
  72.     public function setTotal(string $total): self
  73.     {
  74.         $this->total $total;
  75.         return $this;
  76.     }
  77.     public function getNumerocommande(): ?string
  78.     {
  79.         return $this->numerocommande;
  80.     }
  81.     public function setNumerocommande(string $numerocommande): self
  82.     {
  83.         $this->numerocommande $numerocommande;
  84.         return $this;
  85.     }
  86.     public function getStatus(): ?string
  87.     {
  88.         return $this->status;
  89.     }
  90.     public function setStatus(string $status): self
  91.     {
  92.         $this->status $status;
  93.         return $this;
  94.     }
  95.     /**
  96.      * @return Collection<int, Commission>
  97.      */
  98.     public function getCommissions(): Collection
  99.     {
  100.         return $this->commissions;
  101.     }
  102.     public function addCommission(Commission $commission): self
  103.     {
  104.         if (!$this->commissions->contains($commission)) {
  105.             $this->commissions[] = $commission;
  106.             $commission->setOrderid($this);
  107.         }
  108.         return $this;
  109.     }
  110.     public function removeCommission(Commission $commission): self
  111.     {
  112.         if ($this->commissions->removeElement($commission)) {
  113.             // set the owning side to null (unless already changed)
  114.             if ($commission->getOrderid() === $this) {
  115.                 $commission->setOrderid(null);
  116.             }
  117.         }
  118.         return $this;
  119.     }
  120. }