src/Entity/StockTransaction.php line 13

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