src/Entity/Order.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\OrderRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. /**
  8.  * @ORM\Entity(repositoryClass=OrderRepository::class)
  9.  * @ORM\Table(name="`order`")
  10.  */
  11. class Order
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="datetime")
  21.      */
  22.     private $dateOrder;
  23.     /**
  24.      * @ORM\ManyToOne(targetEntity=UserPlatform::class, inversedBy="listOrders")
  25.      * @ORM\JoinColumn(nullable=false)
  26.      */
  27.     private $customer;
  28.     /**
  29.      * @ORM\Column(type="integer", nullable=true)
  30.      */
  31.     private $state;
  32.     /**
  33.      * @ORM\Column(type="text", nullable=true)
  34.      */
  35.     private $motif;
  36.     /**
  37.      * @ORM\Column(type="string", length=255, nullable=true)
  38.      */
  39.     private $reforder;
  40.     /**
  41.      * @ORM\Column(type="date", nullable=true)
  42.      */
  43.     private $deliveryDate;
  44.     /**
  45.      * @ORM\Column(type="float", nullable=true)
  46.      */
  47.     private ?float $discountAmount = null;
  48.     /**
  49.      * @ORM\Column(type="string", length=50, nullable=true)
  50.      */
  51.     private ?string $couponRef = null;
  52.     /**
  53.      * @ORM\Column(type="float", nullable=true)
  54.      */
  55.     private ?float $totalAfterDiscount = null;
  56.     /**
  57.      * @ORM\OneToMany(
  58.      *     mappedBy="idorder",
  59.      *     targetEntity=DetailsOrders::class,
  60.      *     cascade={"persist","remove"}
  61.      * )
  62.      */
  63.     private Collection $detailsOrders;
  64.     public function getId(): ?int
  65.     {
  66.         return $this->id;
  67.     }
  68.     public function getDateOrder(): ?\DateTimeInterface
  69.     {
  70.         return $this->dateOrder;
  71.     }
  72.     public function setDateOrder(\DateTimeInterface $dateOrder): self
  73.     {
  74.         $this->dateOrder = $dateOrder;
  75.         return $this;
  76.     }
  77.     public function getCustomer(): ?UserPlatform
  78.     {
  79.         return $this->customer;
  80.     }
  81.     public function setCustomer(?UserPlatform $customer): self
  82.     {
  83.         $this->customer = $customer;
  84.         return $this;
  85.     }
  86.     public function getState(): ?int
  87.     {
  88.         return $this->state;
  89.     }
  90.     public function setState(?int $state): self
  91.     {
  92.         $this->state = $state;
  93.         return $this;
  94.     }
  95.     public function getMotif(): ?string
  96.     {
  97.         return $this->motif;
  98.     }
  99.     public function setMotif(?string $motif): self
  100.     {
  101.         $this->motif = $motif;
  102.         return $this;
  103.     }
  104.     public function getReforder(): ?string
  105.     {
  106.         return $this->reforder;
  107.     }
  108.     public function setReforder(?string $reforder): self
  109.     {
  110.         $this->reforder = $reforder;
  111.         return $this;
  112.     }
  113.     public function getDeliveryDate(): ?\DateTimeInterface
  114.     {
  115.         return $this->deliveryDate;
  116.     }
  117.     public function setDeliveryDate(?\DateTimeInterface $deliveryDate): self
  118.     {
  119.         $this->deliveryDate = $deliveryDate;
  120.         return $this;
  121.     }
  122.         public function getDiscountAmount(): ?float
  123.     {
  124.         return $this->discountAmount;
  125.     }
  126.     public function setDiscountAmount(?float $v): self
  127.     {
  128.         $this->discountAmount = $v;
  129.         return $this;
  130.     }
  131.     public function getCouponRef(): ?string
  132.     {
  133.         return $this->couponRef;
  134.     }
  135.     public function setCouponRef(?string $v): self
  136.     {
  137.         $this->couponRef = $v;
  138.         return $this;
  139.     }
  140.     public function getTotalAfterDiscount(): ?float
  141.     {
  142.         return $this->totalAfterDiscount;
  143.     }
  144.     public function setTotalAfterDiscount(?float $v): self
  145.     {
  146.         $this->totalAfterDiscount = $v;
  147.         return $this;
  148.     }
  149.         public function __construct()
  150.     {
  151.         $this->detailsOrders = new ArrayCollection();
  152.     }
  153.         public function getDetailsOrders(): Collection
  154.     {
  155.         return $this->detailsOrders;
  156.     }
  157.     public function addDetailsOrder(DetailsOrders $details): self
  158.     {
  159.         if (!$this->detailsOrders->contains($details)) {
  160.             $this->detailsOrders[] = $details;
  161.             $details->setIdorder($this);
  162.         }
  163.         return $this;
  164.     }
  165.     public function removeDetailsOrder(DetailsOrders $details): self
  166.     {
  167.         if ($this->detailsOrders->removeElement($details)) {
  168.             if ($details->getIdorder() === $this) {
  169.                 $details->setIdorder(null);
  170.             }
  171.         }
  172.         return $this;
  173.     }
  174. }