src/Entity/ShoppingCart.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ShoppingCartRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ShoppingCartRepository::class)
  9.  */
  10. class ShoppingCart
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\ManyToOne(targetEntity=Articles::class, inversedBy="shoppingCarts")
  20.      */
  21.     private $article;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=Establishments::class, inversedBy="shoppingCarts")
  24.      */
  25.     private $establishment;
  26.     /**
  27.      * @ORM\Column(type="float")
  28.      */
  29.     private $quantity 0.0;
  30.     /**
  31.      * @ORM\Column(type="float")
  32.      */
  33.     private $priceUnit 0.0;
  34.     /**
  35.      * @ORM\Column(type="float")
  36.      */
  37.     private $tax 0.0;
  38.     /**
  39.      * @ORM\Column(type="datetime")
  40.      */
  41.     private $createdAt;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity=Users::class, inversedBy="shoppingCarts")
  44.      */
  45.     private $createdBy;
  46.     /**
  47.      * @ORM\Column(type="datetime", nullable=true)
  48.      */
  49.     private $updatedAt;
  50.     /**
  51.      * @ORM\ManyToOne(targetEntity=Users::class, inversedBy="shoppingCartsUsers")
  52.      */
  53.     private $user;
  54.     /**
  55.      * @ORM\ManyToOne(targetEntity=Users::class, inversedBy="shppingCartsUpdatedBy")
  56.      */
  57.     private $updatedBy;
  58.     /**
  59.      * @ORM\Column(type="boolean")
  60.      */
  61.     private $deleted false;
  62.     /**
  63.      * @ORM\OneToMany(targetEntity=BackOrder::class, mappedBy="shoppingCart")
  64.      */
  65.     private $backOrders;
  66.     public function __construct()
  67.     {
  68.         $this->createdAt = new \DateTime();
  69.         $this->updatedAt = new \DateTime();
  70.         $this->backOrders = new ArrayCollection();
  71.     }
  72.     public function getId(): ?int
  73.     {
  74.         return $this->id;
  75.     }
  76.     public function getArticle(): ?Articles
  77.     {
  78.         return $this->article;
  79.     }
  80.     public function setArticle(?Articles $article): self
  81.     {
  82.         $this->article $article;
  83.         return $this;
  84.     }
  85.     public function getEstablishment(): ?Establishments
  86.     {
  87.         return $this->establishment;
  88.     }
  89.     public function setEstablishment(?Establishments $establishment): self
  90.     {
  91.         $this->establishment $establishment;
  92.         return $this;
  93.     }
  94.     public function getQuantity(): ?float
  95.     {
  96.         return $this->quantity;
  97.     }
  98.     public function setQuantity(float $quantity): self
  99.     {
  100.         $this->quantity $quantity;
  101.         return $this;
  102.     }
  103.     public function getPriceUnit(): ?float
  104.     {
  105.         return $this->priceUnit;
  106.     }
  107.     public function setPriceUnit(float $priceUnit): self
  108.     {
  109.         $this->priceUnit $priceUnit;
  110.         return $this;
  111.     }
  112.     public function getTax(): ?float
  113.     {
  114.         return $this->tax;
  115.     }
  116.     public function setTax(float $tax): self
  117.     {
  118.         $this->tax $tax;
  119.         return $this;
  120.     }
  121.     public function getCreatedAt(): ?\DateTimeInterface
  122.     {
  123.         return $this->createdAt;
  124.     }
  125.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  126.     {
  127.         $this->createdAt $createdAt;
  128.         return $this;
  129.     }
  130.     public function getCreatedBy(): ?Users
  131.     {
  132.         return $this->createdBy;
  133.     }
  134.     public function setCreatedBy(?Users $createdBy): self
  135.     {
  136.         $this->createdBy $createdBy;
  137.         return $this;
  138.     }
  139.     public function getUpdatedAt(): ?\DateTimeInterface
  140.     {
  141.         return $this->updatedAt;
  142.     }
  143.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  144.     {
  145.         $this->updatedAt $updatedAt;
  146.         return $this;
  147.     }
  148.     public function getUser(): ?Users
  149.     {
  150.         return $this->user;
  151.     }
  152.     public function setUser(?Users $user): self
  153.     {
  154.         $this->user $user;
  155.         return $this;
  156.     }
  157.     public function getUpdatedBy(): ?Users
  158.     {
  159.         return $this->updatedBy;
  160.     }
  161.     public function setUpdatedBy(?Users $updatedBy): self
  162.     {
  163.         $this->updatedBy $updatedBy;
  164.         return $this;
  165.     }
  166.     public function isDeleted(): ?bool
  167.     {
  168.         return $this->deleted;
  169.     }
  170.     public function setDeleted(bool $deleted): self
  171.     {
  172.         $this->deleted $deleted;
  173.         return $this;
  174.     }
  175.     /**
  176.      * @return Collection<int, BackOrder>
  177.      */
  178.     public function getBackOrders(): Collection
  179.     {
  180.         return $this->backOrders;
  181.     }
  182.     public function addBackOrder(BackOrder $backOrder): self
  183.     {
  184.         if (!$this->backOrders->contains($backOrder)) {
  185.             $this->backOrders[] = $backOrder;
  186.             $backOrder->setShoppingCart($this);
  187.         }
  188.         return $this;
  189.     }
  190.     public function removeBackOrder(BackOrder $backOrder): self
  191.     {
  192.         if ($this->backOrders->removeElement($backOrder)) {
  193.             // set the owning side to null (unless already changed)
  194.             if ($backOrder->getShoppingCart() === $this) {
  195.                 $backOrder->setShoppingCart(null);
  196.             }
  197.         }
  198.         return $this;
  199.     }
  200. }