<?php
namespace App\Entity;
use App\Repository\StockTransactionsRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=StockTransactionsRepository::class)
*/
class StockTransactions
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({
* "transaction.core", "stock_transaction@core"
* })
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Stocks::class, inversedBy="stockTransactions")
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
* @Groups({
* "stock_transaction@stock"
* })
*/
private $stock;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
* @Groups({
* "transaction.core", "stock_transaction@core"
* })
*/
private $transaction_at;
/**
* @ORM\Column(type="stock_transaction_type")
* @Groups({
* "transaction.core", "stock_transaction@core"
* })
*/
private $transaction_type;
/**
* @ORM\Column(type="float")
* @Groups({
* "transaction.core", "stock_transaction@core"
* })
*/
private $quantity;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private $moved_at;
/**
* @ORM\Column(type="float", nullable=true)
* @Groups({
* "stock_transaction@core"
* })
*/
private $buying_price;
/**
* @ORM\Column(type="float", nullable=true)
* @Groups({
* "stock_transaction@core"
* })
*/
private $sales_price;
/**
* @ORM\Column(type="float", nullable=true)
* @Groups({
* "stock_transaction@core"
* })
*/
private $sales_margin;
/**
* @ORM\OneToOne(targetEntity=StockIssuePositions::class, mappedBy="stock_transaction", cascade={"persist", "remove"})
*/
private $stock_issue_position;
/**
* @ORM\ManyToOne(targetEntity=ProjectOrders::class, inversedBy="stock_transactions")
* @Groups({
* "stock_transaction@project_order"
* })
*/
private $project_order;
// /**
// * @ORM\ManyToOne(targetEntity=Stocks::class)
// * @Groups({
// * "transaction.move"
// * })
// */
// private $moved_from;
// /**
// * @ORM\ManyToOne(targetEntity=Stocks::class)
// * @Groups({
// * "transaction.move"
// * })
// */
// private $move_to;
// /**
// * @ORM\ManyToOne(targetEntity=Locations::class, inversedBy="stockTransactions")
// * @Groups({
// * "transaction.location"
// * })
// */
// private $location;
public function getId(): ?int
{
return $this->id;
}
public function getStock(): ?Stocks
{
return $this->stock;
}
public function setStock(?Stocks $stock): self
{
$this->stock = $stock;
return $this;
}
public function getTransactionAt(): ?\DateTimeImmutable
{
return $this->transaction_at;
}
public function setTransactionAt(?\DateTimeImmutable $transaction_at): self
{
$this->transaction_at = $transaction_at;
return $this;
}
public function getTransactionType()
{
return $this->transaction_type;
}
public function setTransactionType($transaction_type): self
{
$this->transaction_type = $transaction_type;
return $this;
}
public function getQuantity(): ?float
{
return $this->quantity;
}
public function setQuantity(float $quantity): self
{
$this->quantity = $quantity;
return $this;
}
public function getBuyingPrice(): ?float
{
return $this->buying_price;
}
public function setBuyingPrice(?float $buying_price): self
{
$this->buying_price = $buying_price;
return $this;
}
public function getMovedAt(): ?\DateTimeImmutable
{
return $this->moved_at;
}
public function setMovedAt(?\DateTimeImmutable $moved_at): self
{
$this->moved_at = $moved_at;
return $this;
}
public function getMovedFrom(): ?Locations
{
return $this->moved_from;
}
public function setMovedFrom(?Stocks $stock): self
{
$this->moved_from = $stock;
return $this;
}
public function getMoveTo(): ?Stocks
{
return $this->move_to;
}
public function setMoveTo(?Stocks $move_to): self
{
$this->move_to = $move_to;
return $this;
}
public function getSalesPrice(): ?float
{
return $this->sales_price;
}
public function setSalesPrice(?float $sales_price): self
{
$this->sales_price = $sales_price;
return $this;
}
public function getSalesMargin(): ?float
{
return $this->sales_margin;
}
public function setSalesMargin(?float $sales_margin): self
{
$this->sales_margin = $sales_margin;
return $this;
}
public function getStockIssuePosition(): ?StockIssuePositions
{
return $this->stock_issue_position;
}
public function setStockIssuePosition(?StockIssuePositions $stock_issue_position): self
{
// unset the owning side of the relation if necessary
if ($stock_issue_position === null && $this->stock_issue_position !== null) {
$this->stock_issue_position->setStockTransaction(null);
}
// set the owning side of the relation if necessary
if ($stock_issue_position !== null && $stock_issue_position->getStockTransaction() !== $this) {
$stock_issue_position->setStockTransaction($this);
}
$this->stock_issue_position = $stock_issue_position;
return $this;
}
public function getProjectOrder(): ?ProjectOrders
{
return $this->project_order;
}
public function setProjectOrder(?ProjectOrders $project_order): self
{
$this->project_order = $project_order;
return $this;
}
}