<?phpnamespace App\Entity;use App\Repository\ShopOrderProductRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;/** * @ORM\Entity(repositoryClass=ShopOrderProductRepository::class) */class ShopOrderProduct{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=ShopOrder::class, inversedBy="shopOrderProducts") * ORM\JoinColumn(nullable=false) */ private $shop_order; /** * @ORM\ManyToOne(targetEntity=ShopProduit::class, inversedBy="shopOrderProducts") * @ORM\JoinColumn(nullable=false) */ private $product; /** * @ORM\Column(type="integer") */ private $quantite; /** * @ORM\Column(type="float") */ private $price; /** * @ORM\Column(type="string", length=255) */ private $intitule; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $descriptif; /** * @ORM\Column(type="integer") */ private $points; /** * @ORM\Column(type="datetime") * @Gedmo\Timestampable(on="create") */ private $createdAt; /** * @ORM\Column(type="datetime") * @Gedmo\Timestampable(on="update") */ private $updatedAt; /** * @ORM\OneToMany(targetEntity=ShopOrderProductConsommation::class, mappedBy="shop_order_product") */ private $ShopOrderProductConsommations; /** * @ORM\ManyToOne(targetEntity=ShopCategorie::class, inversedBy="shopOrderProducts") * @ORM\JoinColumn(nullable=false) */ private $categorie; public function __construct() { $this->ShopOrderProductConsommations = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getShopOrder(): ?ShopOrder { return $this->shop_order; } public function setShopOrder(?ShopOrder $shop_order): self { $this->shop_order = $shop_order; return $this; } public function getProduct(): ?ShopProduit { return $this->product; } public function setProduct(?ShopProduit $product): self { $this->product = $product; return $this; } public function getQuantite(): ?int { return $this->quantite; } public function setQuantite(int $quantite): self { $this->quantite = $quantite; return $this; } public function getPrice(): ?float { return $this->price; } public function setPrice(float $price): self { $this->price = $price; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(?\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updatedAt; } public function setUpdatedAt(?\DateTimeInterface $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } public function getIntitule(): ?string { return $this->intitule; } public function setIntitule(string $intitule): self { $this->intitule = $intitule; return $this; } public function getDescriptif(): ?string { return $this->descriptif; } public function setDescriptif(?string $descriptif): self { $this->descriptif = $descriptif; return $this; } public function getPoints(): ?int { return $this->points; } public function setPoints(int $points): self { $this->points = $points; return $this; } public function getTotal(): ?float { return $this->getPrice() * $this->getQuantite(); } public function getTotalPoints(): ?int { return $this->getPoints() * $this->getQuantite(); } /** * @return Collection|ShopOrderProductConsommation[] */ public function getShopOrderProductConsommations(): Collection { return $this->ShopOrderProductConsommations; } public function addShopOrderProductConsommation(ShopOrderProductConsommation $ShopOrderProductConsommation): self { if (!$this->ShopOrderProductConsommations->contains($ShopOrderProductConsommation)) { $this->ShopOrderProductConsommations[] = $ShopOrderProductConsommation; $ShopOrderProductConsommation->setShopOrderProduct($this); } return $this; } public function removeShopOrderProductConsommation(ShopOrderProductConsommation $ShopOrderProductConsommation): self { if ($this->ShopOrderProductConsommations->removeElement($ShopOrderProductConsommation)) { // set the owning side to null (unless already changed) if ($ShopOrderProductConsommation->getShopOrderProduct() === $this) { $ShopOrderProductConsommation->setShopOrderProduct(null); } } return $this; } public function getCategorie(): ?ShopCategorie { return $this->categorie; } public function setCategorie(?ShopCategorie $categorie): self { $this->categorie = $categorie; return $this; }}