src/Entity/StockTransactions.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\StockTransactionsRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. /**
  7.  * @ORM\Entity(repositoryClass=StockTransactionsRepository::class)
  8.  */
  9. class StockTransactions
  10. {
  11.     /**
  12.      * @ORM\Id
  13.      * @ORM\GeneratedValue
  14.      * @ORM\Column(type="integer")
  15.      * @Groups({
  16.      *     "transaction.core", "stock_transaction@core"
  17.      * })
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\ManyToOne(targetEntity=Stocks::class, inversedBy="stockTransactions")
  22.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  23.      * @Groups({
  24.      *       "stock_transaction@stock"
  25.      *   })
  26.      */
  27.     private $stock;
  28.     /**
  29.      * @ORM\Column(type="datetime_immutable", nullable=true)
  30.      * @Groups({
  31.      *      "transaction.core", "stock_transaction@core"
  32.      *  })
  33.      */
  34.     private $transaction_at;
  35.     /**
  36.      * @ORM\Column(type="stock_transaction_type")
  37.      * @Groups({
  38.      *      "transaction.core", "stock_transaction@core"
  39.      *  })
  40.      */
  41.     private $transaction_type;
  42.     /**
  43.      * @ORM\Column(type="float")
  44.      * @Groups({
  45.      *      "transaction.core", "stock_transaction@core"
  46.      *  })
  47.      */
  48.     private $quantity;
  49.     /**
  50.      * @ORM\Column(type="datetime_immutable", nullable=true)
  51.      */
  52.     private $moved_at;
  53.     /**
  54.      * @ORM\Column(type="float", nullable=true)
  55.      * @Groups({
  56.      *       "stock_transaction@core"
  57.      *   })
  58.      */
  59.     private $buying_price;
  60.     /**
  61.      * @ORM\Column(type="float", nullable=true)
  62.      * @Groups({
  63.      *        "stock_transaction@core"
  64.      *    })
  65.      */
  66.     private $sales_price;
  67.     /**
  68.      * @ORM\Column(type="float", nullable=true)
  69.      * @Groups({
  70.      *        "stock_transaction@core"
  71.      *    })
  72.      */
  73.     private $sales_margin;
  74.     /**
  75.      * @ORM\OneToOne(targetEntity=StockIssuePositions::class, mappedBy="stock_transaction", cascade={"persist", "remove"})
  76.      */
  77.     private $stock_issue_position;
  78.     /**
  79.      * @ORM\ManyToOne(targetEntity=ProjectOrders::class, inversedBy="stock_transactions")
  80.      * @Groups({
  81.      *         "stock_transaction@project_order"
  82.      *     })
  83.      */
  84.     private $project_order;
  85. //    /**
  86. //     * @ORM\ManyToOne(targetEntity=Stocks::class)
  87. //     * @Groups({
  88. //     *         "transaction.move"
  89. //     *     })
  90. //     */
  91. //    private $moved_from;
  92. //    /**
  93. //     * @ORM\ManyToOne(targetEntity=Stocks::class)
  94. //     * @Groups({
  95. //     *         "transaction.move"
  96. //     *     })
  97. //     */
  98. //    private $move_to;
  99. //    /**
  100. //     * @ORM\ManyToOne(targetEntity=Locations::class, inversedBy="stockTransactions")
  101. //     * @Groups({
  102. //     *        "transaction.location"
  103. //     *    })
  104. //     */
  105. //    private $location;
  106.     public function getId(): ?int
  107.     {
  108.         return $this->id;
  109.     }
  110.     public function getStock(): ?Stocks
  111.     {
  112.         return $this->stock;
  113.     }
  114.     public function setStock(?Stocks $stock): self
  115.     {
  116.         $this->stock $stock;
  117.         return $this;
  118.     }
  119.     public function getTransactionAt(): ?\DateTimeImmutable
  120.     {
  121.         return $this->transaction_at;
  122.     }
  123.     public function setTransactionAt(?\DateTimeImmutable $transaction_at): self
  124.     {
  125.         $this->transaction_at $transaction_at;
  126.         return $this;
  127.     }
  128.     public function getTransactionType()
  129.     {
  130.         return $this->transaction_type;
  131.     }
  132.     public function setTransactionType($transaction_type): self
  133.     {
  134.         $this->transaction_type $transaction_type;
  135.         return $this;
  136.     }
  137.     public function getQuantity(): ?float
  138.     {
  139.         return $this->quantity;
  140.     }
  141.     public function setQuantity(float $quantity): self
  142.     {
  143.         $this->quantity $quantity;
  144.         return $this;
  145.     }
  146.     public function getBuyingPrice(): ?float
  147.     {
  148.         return $this->buying_price;
  149.     }
  150.     public function setBuyingPrice(?float $buying_price): self
  151.     {
  152.         $this->buying_price $buying_price;
  153.         return $this;
  154.     }
  155.     public function getMovedAt(): ?\DateTimeImmutable
  156.     {
  157.         return $this->moved_at;
  158.     }
  159.     public function setMovedAt(?\DateTimeImmutable $moved_at): self
  160.     {
  161.         $this->moved_at $moved_at;
  162.         return $this;
  163.     }
  164.     public function getMovedFrom(): ?Locations
  165.     {
  166.         return $this->moved_from;
  167.     }
  168.     public function setMovedFrom(?Stocks $stock): self
  169.     {
  170.         $this->moved_from $stock;
  171.         return $this;
  172.     }
  173.     public function getMoveTo(): ?Stocks
  174.     {
  175.         return $this->move_to;
  176.     }
  177.     public function setMoveTo(?Stocks $move_to): self
  178.     {
  179.         $this->move_to $move_to;
  180.         return $this;
  181.     }
  182.     public function getSalesPrice(): ?float
  183.     {
  184.         return $this->sales_price;
  185.     }
  186.     public function setSalesPrice(?float $sales_price): self
  187.     {
  188.         $this->sales_price $sales_price;
  189.         return $this;
  190.     }
  191.     public function getSalesMargin(): ?float
  192.     {
  193.         return $this->sales_margin;
  194.     }
  195.     public function setSalesMargin(?float $sales_margin): self
  196.     {
  197.         $this->sales_margin $sales_margin;
  198.         return $this;
  199.     }
  200.     public function getStockIssuePosition(): ?StockIssuePositions
  201.     {
  202.         return $this->stock_issue_position;
  203.     }
  204.     public function setStockIssuePosition(?StockIssuePositions $stock_issue_position): self
  205.     {
  206.         // unset the owning side of the relation if necessary
  207.         if ($stock_issue_position === null && $this->stock_issue_position !== null) {
  208.             $this->stock_issue_position->setStockTransaction(null);
  209.         }
  210.         // set the owning side of the relation if necessary
  211.         if ($stock_issue_position !== null && $stock_issue_position->getStockTransaction() !== $this) {
  212.             $stock_issue_position->setStockTransaction($this);
  213.         }
  214.         $this->stock_issue_position $stock_issue_position;
  215.         return $this;
  216.     }
  217.     public function getProjectOrder(): ?ProjectOrders
  218.     {
  219.         return $this->project_order;
  220.     }
  221.     public function setProjectOrder(?ProjectOrders $project_order): self
  222.     {
  223.         $this->project_order $project_order;
  224.         return $this;
  225.     }
  226. }