src/Entity/PurchaseProductItem.php line 17

Open in your IDE?
  1. <?php
  2.     namespace App\Entity;
  3.     use App\Repository\PurchaseProductItemRepository;
  4.     use App\Traits\DateTrait;
  5.     use Doctrine\ORM\Mapping as ORM;
  6.     use JMS\Serializer\Annotation as Serializer;
  7.     use JMS\Serializer\Annotation\Expose;
  8.     use JMS\Serializer\Annotation\Groups;
  9.     /**
  10.      * @ORM\Entity(repositoryClass=PurchaseProductItemRepository::class)
  11.      *
  12.      * @Serializer\ExclusionPolicy("ALL")
  13.      */
  14.     class PurchaseProductItem
  15.     {
  16.         /**
  17.          * @ORM\Id
  18.          * @ORM\GeneratedValue
  19.          * @ORM\Column(type="integer")
  20.          */
  21.         private $id;
  22.         /**
  23.          * @ORM\ManyToOne(targetEntity=Purchase::class, inversedBy="items"))
  24.          */
  25.         private $purchase;
  26.         /**
  27.          * @ORM\Column(type="integer")
  28.          */
  29.         private $quantity;
  30.         /**
  31.          * @ORM\Column(type="decimal", precision=12, scale=4, nullable=true)
  32.          */
  33.         private $buyingPrice;
  34.         /**
  35.          * @ORM\ManyToOne(targetEntity=PurchaseProduct::class, inversedBy="purchaseItems")
  36.          *
  37.          * @@Serializer\Expose()
  38.          * @Serializer\Groups({"export_purchase_declaration_datatable"})
  39.          */
  40.         private $product;
  41.         use DateTrait;
  42.         /**
  43.          * @return string
  44.          * @Serializer\VirtualProperty()
  45.          * @Serializer\SerializedName("product_ref_name")
  46.          *
  47.          * @Expose()
  48.          * @Groups({"export_purchase_declaration_datatable"})
  49.          */
  50.         public function getProductRefName(): string
  51.         {
  52.             return $this->getProduct()->getRefName();
  53.         }
  54.         public function getId(): ?int
  55.         {
  56.             return $this->id;
  57.         }
  58.         public function getPurchase(): ?Purchase
  59.         {
  60.             return $this->purchase;
  61.         }
  62.         public function setPurchase( ?Purchase $purchase ): self
  63.         {
  64.             $this->purchase $purchase;
  65.             return $this;
  66.         }
  67.         public function getQuantity(): ?int
  68.         {
  69.             return $this->quantity;
  70.         }
  71.         public function setQuantityint $quantity ): self
  72.         {
  73.             $this->quantity $quantity;
  74.             return $this;
  75.         }
  76.         public function getBuyingPrice(): ?string
  77.         {
  78.             return $this->buyingPrice;
  79.         }
  80.         public function setBuyingPrice( ?string $buyingPrice ): self
  81.         {
  82.             $this->buyingPrice $buyingPrice;
  83.             return $this;
  84.         }
  85.         public function getProduct(): ?PurchaseProduct
  86.         {
  87.             return $this->product;
  88.         }
  89.         public function setProduct( ?PurchaseProduct $product ): self
  90.         {
  91.             $this->product $product;
  92.             return $this;
  93.         }
  94.     }