src/Entity/ShopOrderProduct.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ShopOrderProductRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ShopOrderProductRepository::class)
  10.  */
  11. class ShopOrderProduct
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\ManyToOne(targetEntity=ShopOrder::class, inversedBy="shopOrderProducts")
  21.      * ORM\JoinColumn(nullable=false)
  22.      */
  23.     private $shop_order;
  24.     /**
  25.      * @ORM\ManyToOne(targetEntity=ShopProduit::class, inversedBy="shopOrderProducts")
  26.      * @ORM\JoinColumn(nullable=false)
  27.      */
  28.     private $product;
  29.     /**
  30.      * @ORM\Column(type="integer")
  31.      */
  32.     private $quantite;
  33.     /**
  34.      * @ORM\Column(type="float")
  35.      */
  36.     private $price;
  37.      /**
  38.      * @ORM\Column(type="string", length=255)
  39.      */
  40.     private $intitule;
  41.     /**
  42.      * @ORM\Column(type="string", length=255, nullable=true)
  43.      */
  44.     private $descriptif;
  45.     /**
  46.      * @ORM\Column(type="integer")
  47.      */
  48.     private $points;
  49.     /**
  50.     * @ORM\Column(type="datetime")
  51.     * @Gedmo\Timestampable(on="create")
  52.     */
  53.     private $createdAt;
  54.     /**
  55.      * @ORM\Column(type="datetime")
  56.      * @Gedmo\Timestampable(on="update")
  57.      */
  58.     private $updatedAt;
  59.     /**
  60.      * @ORM\OneToMany(targetEntity=ShopOrderProductConsommation::class, mappedBy="shop_order_product")
  61.      */
  62.     private $ShopOrderProductConsommations;
  63.     /**
  64.      * @ORM\ManyToOne(targetEntity=ShopCategorie::class, inversedBy="shopOrderProducts")
  65.      * @ORM\JoinColumn(nullable=false)
  66.      */
  67.     private $categorie;
  68.     public function __construct()
  69.     {
  70.         $this->ShopOrderProductConsommations = new ArrayCollection();
  71.     }
  72.     public function getId(): ?int
  73.     {
  74.         return $this->id;
  75.     }
  76.     public function getShopOrder(): ?ShopOrder
  77.     {
  78.         return $this->shop_order;
  79.     }
  80.     public function setShopOrder(?ShopOrder $shop_order): self
  81.     {
  82.         $this->shop_order $shop_order;
  83.         return $this;
  84.     }
  85.     public function getProduct(): ?ShopProduit
  86.     {
  87.         return $this->product;
  88.     }
  89.     public function setProduct(?ShopProduit $product): self
  90.     {
  91.         $this->product $product;
  92.         return $this;
  93.     }
  94.     public function getQuantite(): ?int
  95.     {
  96.         return $this->quantite;
  97.     }
  98.     public function setQuantite(int $quantite): self
  99.     {
  100.         $this->quantite $quantite;
  101.         return $this;
  102.     }
  103.     public function getPrice(): ?float
  104.     {
  105.         return $this->price;
  106.     }
  107.     public function setPrice(float $price): self
  108.     {
  109.         $this->price $price;
  110.         return $this;
  111.     }
  112.     public function getCreatedAt(): ?\DateTimeInterface {
  113.         return $this->createdAt;
  114.     }
  115.     public function setCreatedAt(?\DateTimeInterface $createdAt): self {
  116.         $this->createdAt $createdAt;                                                         
  117.         return $this;
  118.     }
  119.     
  120.     public function getUpdatedAt(): ?\DateTimeInterface {
  121.         return $this->updatedAt;
  122.     }
  123.     
  124.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self {
  125.         $this->updatedAt $updatedAt;                                                         
  126.         return $this;
  127.     }
  128.     public function getIntitule(): ?string
  129.     {
  130.         return $this->intitule;
  131.     }
  132.     public function setIntitule(string $intitule): self
  133.     {
  134.         $this->intitule $intitule;
  135.         return $this;
  136.     }
  137.     public function getDescriptif(): ?string
  138.     {
  139.         return $this->descriptif;
  140.     }
  141.     public function setDescriptif(?string $descriptif): self
  142.     {
  143.         $this->descriptif $descriptif;
  144.         return $this;
  145.     }
  146.     public function getPoints(): ?int
  147.     {
  148.         return $this->points;
  149.     }
  150.     public function setPoints(int $points): self
  151.     {
  152.         $this->points $points;
  153.         return $this;
  154.     }
  155.     public function getTotal(): ?float
  156.     {
  157.         return $this->getPrice() * $this->getQuantite();
  158.     }
  159.     public function getTotalPoints(): ?int
  160.     {
  161.         return $this->getPoints() * $this->getQuantite();
  162.     }
  163.     /**
  164.      * @return Collection|ShopOrderProductConsommation[]
  165.      */
  166.     public function getShopOrderProductConsommations(): Collection
  167.     {
  168.         return $this->ShopOrderProductConsommations;
  169.     }
  170.     public function addShopOrderProductConsommation(ShopOrderProductConsommation $ShopOrderProductConsommation): self
  171.     {
  172.         if (!$this->ShopOrderProductConsommations->contains($ShopOrderProductConsommation)) {
  173.             $this->ShopOrderProductConsommations[] = $ShopOrderProductConsommation;
  174.             $ShopOrderProductConsommation->setShopOrderProduct($this);
  175.         }
  176.         return $this;
  177.     }
  178.     public function removeShopOrderProductConsommation(ShopOrderProductConsommation $ShopOrderProductConsommation): self
  179.     {
  180.         if ($this->ShopOrderProductConsommations->removeElement($ShopOrderProductConsommation)) {
  181.             // set the owning side to null (unless already changed)
  182.             if ($ShopOrderProductConsommation->getShopOrderProduct() === $this) {
  183.                 $ShopOrderProductConsommation->setShopOrderProduct(null);
  184.             }
  185.         }
  186.         return $this;
  187.     }
  188.     public function getCategorie(): ?ShopCategorie
  189.     {
  190.         return $this->categorie;
  191.     }
  192.     public function setCategorie(?ShopCategorie $categorie): self
  193.     {
  194.         $this->categorie $categorie;
  195.         return $this;
  196.     }
  197. }