src/Entity/ProductOut.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\ProductOutRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Timestampable\Traits\TimestampableEntity;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ProductOutRepository::class)
  10.  * @ApiResource(
  11.  *  normalizationContext={"groups"={"product_out:read"}},
  12.  *  denormalizationContext={"groups"={"product_out:write"}},
  13.  * )
  14.  */
  15. class ProductOut
  16. {
  17.     use TimestampableEntity;
  18.     /**
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue
  21.      * @ORM\Column(type="integer")
  22.      * @Groups({"product:read"})
  23.      */
  24.     private $id;
  25.     /**
  26.      * @ORM\ManyToOne(targetEntity=Product::class, inversedBy="productOuts")
  27.      * @Groups({"product_out:read", "product_out:write"})
  28.      */
  29.     private $product;
  30.     /**
  31.      * @ORM\Column(type="integer")
  32.      * @Groups({"product_out:read", "product_out:write"})
  33.      */
  34.     private $qty;
  35.     /**
  36.      * @ORM\Column(type="date")
  37.      * @Groups({"product_out:read", "product_out:write"})
  38.      */
  39.     private $date;
  40.     /**
  41.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="productOuts")
  42.      * @Groups({"product_out:read", "product_out:write"})
  43.      */
  44.     private $user;
  45.     /**
  46.      * @ORM\Column(type="string", length=255, nullable=true)
  47.      * @Groups({"product_out:read", "product_out:write"})
  48.      */
  49.     private $orderRef;
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function getProduct(): ?Product
  55.     {
  56.         return $this->product;
  57.     }
  58.     public function setProduct(?Product $product): self
  59.     {
  60.         $this->product $product;
  61.         return $this;
  62.     }
  63.     public function getQty(): ?int
  64.     {
  65.         return $this->qty;
  66.     }
  67.     public function setQty(int $qty): self
  68.     {
  69.         $this->qty $qty;
  70.         return $this;
  71.     }
  72.     public function getDate(): ?\DateTimeInterface
  73.     {
  74.         return $this->date;
  75.     }
  76.     public function setDate(\DateTimeInterface $date): self
  77.     {
  78.         $this->date $date;
  79.         return $this;
  80.     }
  81.     public function getUser(): ?User
  82.     {
  83.         return $this->user;
  84.     }
  85.     public function setUser(?User $user): self
  86.     {
  87.         $this->user $user;
  88.         return $this;
  89.     }
  90.     public function getOrderRef(): ?string
  91.     {
  92.         return $this->orderRef;
  93.     }
  94.     public function setOrderRef(?string $orderRef): self
  95.     {
  96.         $this->orderRef $orderRef;
  97.         return $this;
  98.     }
  99. }