<?php namespace App\Entity; use App\Repository\PurchaseProductItemRepository; use App\Traits\DateTrait; use Doctrine\ORM\Mapping as ORM; use JMS\Serializer\Annotation as Serializer; use JMS\Serializer\Annotation\Expose; use JMS\Serializer\Annotation\Groups; /** * @ORM\Entity(repositoryClass=PurchaseProductItemRepository::class) * * @Serializer\ExclusionPolicy("ALL") */ class PurchaseProductItem { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=Purchase::class, inversedBy="items")) */ private $purchase; /** * @ORM\Column(type="integer") */ private $quantity; /** * @ORM\Column(type="decimal", precision=12, scale=4, nullable=true) */ private $buyingPrice; /** * @ORM\ManyToOne(targetEntity=PurchaseProduct::class, inversedBy="purchaseItems") * * @@Serializer\Expose() * @Serializer\Groups({"export_purchase_declaration_datatable"}) */ private $product; /** * Longueur du produit * * @ORM\Column(type="integer", nullable=true) */ private $width; /** * Hauteur du produit * * @ORM\Column(type="integer", nullable=true) */ private $height; use DateTrait; /** * @return string * @Serializer\VirtualProperty() * @Serializer\SerializedName("product_ref_name") * * @Expose() * @Groups({"export_purchase_declaration_datatable"}) */ public function getProductRefName(): string { return $this->getProduct()->getRefName(); } public function getId(): ?int { return $this->id; } public function getPurchase(): ?Purchase { return $this->purchase; } public function setPurchase( ?Purchase $purchase ): self { $this->purchase = $purchase; return $this; } public function getQuantity(): ?int { return $this->quantity; } public function setQuantity( int $quantity ): self { $this->quantity = $quantity; return $this; } public function getBuyingPrice(): ?string { return $this->buyingPrice; } public function setBuyingPrice( ?string $buyingPrice ): self { $this->buyingPrice = $buyingPrice; return $this; } public function getProduct(): ?PurchaseProduct { return $this->product; } public function setProduct( ?PurchaseProduct $product ): self { $this->product = $product; return $this; } public function getWidth(): ?int { return $this->width; } public function setWidth( ?int $width ): self { $this->width = $width; return $this; } public function getHeight(): ?int { return $this->height; } public function setHeight( ?int $height ): self { $this->height = $height; return $this; } }