src/Entity/StockTransaction.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\StockTransactionSource;
  4. use App\Repository\StockTransactionRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[ORM\Entity(repositoryClassStockTransactionRepository::class)]
  10. #[ORM\HasLifecycleCallbacks]
  11. class StockTransaction extends BaseEntity
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column(type'integer')]
  16.     private $id;
  17.     #[ORM\Column(type'string'length255)]
  18.     private $name;
  19.     #[ORM\Column(type'text')]
  20.     private $description;
  21.     #[ORM\OneToMany(mappedBy'transaction'targetEntityStockTransfer::class)]
  22.     #[ORM\JoinColumn(nullabletrueonDelete"SET NULL")]
  23.     private $stockTransfers;
  24.     #[ORM\Column(type'decimal'precision10scale2nullabletrue)]
  25.     private $quantity;
  26.     #[ORM\Column(type'decimal'precision10scale2nullabletrue)]
  27.     private $beforeQuantity;
  28.     #[ORM\Column(type'decimal'precision10scale2nullabletrue)]
  29.     private $afterQuantity;
  30.     #[ORM\Column(type'string'nullabletrue)]
  31.     private $action;
  32.     #[ORM\Column(type'text'nullabletrue)]
  33.     private $objectOfAction;
  34.     #[ORM\ManyToOne(targetEntityProduct::class, inversedBy'stockTransactions')]
  35.     #[ORM\JoinColumn(nullabletrueonDelete"SET NULL")]
  36.     private $productId;
  37.     #[ORM\ManyToOne(targetEntitySales::class, inversedBy'stockTransactions')]
  38.     #[ORM\JoinColumn(nullabletrueonDelete"SET NULL")]
  39.     private $sale;
  40.     #[ORM\ManyToOne(targetEntitySalesReturn::class)]
  41.     #[ORM\JoinColumn(nullabletrueonDelete"SET NULL")]
  42.     private ?SalesReturn $salesReturn null;
  43.     #[ORM\ManyToOne(targetEntityWarehouse::class, inversedBy'stockTransactions')]
  44.     #[ORM\JoinColumn(nullabletrueonDelete"SET NULL")]
  45.     private $warehouse;
  46.     #[ORM\ManyToOne(targetEntityInvoice::class, inversedBy'stockTransactions')]
  47.     #[ORM\JoinColumn(nullabletrueonDelete"SET NULL")]
  48.     private $invoice;
  49.     #[ORM\ManyToOne]
  50.     private ?MeasurementUnits $baseUnit null;
  51.     #[ORM\ManyToOne]
  52.     private ?MeasurementUnits $soldedUnit null;
  53.     #[ORM\Column(typeTypes::DECIMALprecision10scale2nullabletrue)]
  54.     private ?string $soldQuantity null;
  55.     #[ORM\Column(type'string'length32nullabletrueenumTypeStockTransactionSource::class)]
  56.     private ?StockTransactionSource $source null;
  57.     public function __construct()
  58.     {
  59.         $this->stockTransfers = new ArrayCollection();
  60.     }
  61.     public function __toString(): string
  62.     {
  63.         return $this->name;
  64.     }
  65.     public function getId(): ?int
  66.     {
  67.         return $this->id;
  68.     }
  69.     public function getName(): ?string
  70.     {
  71.         return $this->name;
  72.     }
  73.     public function setName(string $name): self
  74.     {
  75.         $this->name $name;
  76.         return $this;
  77.     }
  78.     public function getDescription(): ?string
  79.     {
  80.         return $this->description;
  81.     }
  82.     public function setDescription(?string $description): self
  83.     {
  84.         $this->description $description ?? '';
  85.         return $this;
  86.     }
  87.     /**
  88.      * @return Collection<int, StockTransfer>
  89.      */
  90.     public function getStockTransfers(): Collection
  91.     {
  92.         return $this->stockTransfers;
  93.     }
  94.     public function addStockTransfer(StockTransfer $stockTransfer): self
  95.     {
  96.         if (!$this->stockTransfers->contains($stockTransfer)) {
  97.             $this->stockTransfers[] = $stockTransfer;
  98.             $stockTransfer->setTransaction($this);
  99.         }
  100.         return $this;
  101.     }
  102.     public function removeStockTransfer(StockTransfer $stockTransfer): self
  103.     {
  104.         if ($this->stockTransfers->removeElement($stockTransfer)) {
  105.             // set the owning side to null (unless already changed)
  106.             if ($stockTransfer->getTransaction() === $this) {
  107.                 $stockTransfer->setTransaction(null);
  108.             }
  109.         }
  110.         return $this;
  111.     }
  112.     /**
  113.      * @return mixed
  114.      */
  115.     public function getQuantity()
  116.     {
  117.         return $this->quantity;
  118.     }
  119.     /**
  120.      * @param mixed $quantity
  121.      */
  122.     public function setQuantity($quantity): self
  123.     {
  124.         $this->quantity $quantity;
  125.         return $this;
  126.     }
  127.     /**
  128.      * @return mixed
  129.      */
  130.     public function getBeforeQuantity()
  131.     {
  132.         return $this->beforeQuantity;
  133.     }
  134.     /**
  135.      * @param mixed $beforeQuantity
  136.      */
  137.     public function setBeforeQuantity($beforeQuantity): self
  138.     {
  139.         $this->beforeQuantity $beforeQuantity;
  140.         return $this;
  141.     }
  142.     /**
  143.      * @return mixed
  144.      */
  145.     public function getAfterQuantity()
  146.     {
  147.         return $this->afterQuantity;
  148.     }
  149.     /**
  150.      * @param mixed $afterQuantity
  151.      */
  152.     public function setAfterQuantity($afterQuantity): self
  153.     {
  154.         $this->afterQuantity $afterQuantity;
  155.         return $this;
  156.     }
  157.     /**
  158.      * @return mixed
  159.      */
  160.     public function getAction()
  161.     {
  162.         return $this->action;
  163.     }
  164.     /**
  165.      * @param mixed $action
  166.      */
  167.     public function setAction($action): self
  168.     {
  169.         $this->action $action;
  170.         return $this;
  171.     }
  172.     /**
  173.      * @return mixed
  174.      */
  175.     public function getObjectOfAction()
  176.     {
  177.         return $this->objectOfAction;
  178.     }
  179.     /**
  180.      * @param mixed $objectOfAction
  181.      */
  182.     public function setObjectOfAction($objectOfAction): self
  183.     {
  184.         $this->objectOfAction $objectOfAction;
  185.         return $this;
  186.     }
  187.     public function getProductId(): ?Product
  188.     {
  189.         return $this->productId;
  190.     }
  191.     public function setProductId(?Product $productId): self
  192.     {
  193.         $this->productId $productId;
  194.         return $this;
  195.     }
  196.     public function getSale(): ?Sales
  197.     {
  198.         return $this->sale;
  199.     }
  200.     public function setSale(?Sales $sale): self
  201.     {
  202.         $this->sale $sale;
  203.         return $this;
  204.     }
  205.     public function getSalesReturn(): ?SalesReturn
  206.     {
  207.         return $this->salesReturn;
  208.     }
  209.     public function setSalesReturn(?SalesReturn $salesReturn): self
  210.     {
  211.         $this->salesReturn $salesReturn;
  212.         return $this;
  213.     }
  214.     public function getWarehouse(): ?Warehouse
  215.     {
  216.         return $this->warehouse;
  217.     }
  218.     public function setWarehouse(?Warehouse $warehouse): self
  219.     {
  220.         $this->warehouse $warehouse;
  221.         return $this;
  222.     }
  223.     /**
  224.      * @return mixed
  225.      */
  226.     public function getInvoice()
  227.     {
  228.         return $this->invoice;
  229.     }
  230.     /**
  231.      * @param mixed $invoice
  232.      */
  233.     public function setInvoice($invoice): self
  234.     {
  235.         $this->invoice $invoice;
  236.         return $this;
  237.     }
  238.     public function getBaseUnit(): ?MeasurementUnits
  239.     {
  240.         return $this->baseUnit;
  241.     }
  242.     public function setBaseUnit(?MeasurementUnits $baseUnit): static
  243.     {
  244.         $this->baseUnit $baseUnit;
  245.         return $this;
  246.     }
  247.     public function getSoldedUnit(): ?MeasurementUnits
  248.     {
  249.         return $this->soldedUnit;
  250.     }
  251.     public function setSoldedUnit(?MeasurementUnits $soldedUnit): static
  252.     {
  253.         $this->soldedUnit $soldedUnit;
  254.         return $this;
  255.     }
  256.     public function getSoldQuantity(): ?string
  257.     {
  258.         return $this->soldQuantity;
  259.     }
  260.     public function setSoldQuantity(?string $soldQuantity): static
  261.     {
  262.         $this->soldQuantity $soldQuantity;
  263.         return $this;
  264.     }
  265.     public function getSource(): ?StockTransactionSource
  266.     {
  267.         return $this->source;
  268.     }
  269.     public function setSource(?StockTransactionSource $source): self
  270.     {
  271.         $this->source $source;
  272.         return $this;
  273.     }
  274. }