src/Entity/Warehouse.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\WarehouseRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassWarehouseRepository::class)]
  8. #[ORM\HasLifecycleCallbacks]
  9. class Warehouse extends BaseEntity
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column(type'integer')]
  14.     private $id;
  15.     #[ORM\Column(type'string'length255)]
  16.     private $name;
  17.     #[ORM\Column(type'string'length255)]
  18.     private $country;
  19.     #[ORM\Column(type'string'length255nullabletrue)]
  20.     private $address;
  21.     #[ORM\Column(type'string'length255nullabletrue)]
  22.     private $phone;
  23.     #[ORM\Column(type'string'length255nullabletrue)]
  24.     private $fax;
  25.     #[ORM\OneToMany(mappedBy'warehouse'targetEntityStock::class, orphanRemovaltrue)]
  26.     private $stocks;
  27.     #[ORM\OneToMany(mappedBy'outWarehouse'targetEntityStockTransfer::class, orphanRemovaltrue)]
  28.     private $outgoingTransfers;
  29.     #[ORM\OneToMany(mappedBy'arrivalWarehouse'targetEntityStockTransfer::class, orphanRemovaltrue)]
  30.     private $incomingTransfers;
  31.     #[ORM\OneToMany(mappedBy'warehouse'targetEntityStockInfo::class)]
  32.     private $stockInfos;
  33.     #[ORM\OneToMany(mappedBy'warehouse'targetEntitySales::class)]
  34.     private $sales;
  35.     #[ORM\Column(type'boolean')]
  36.     private $isMainWarehouse;
  37.     #[ORM\OneToMany(mappedBy'arrivalWarehouse'targetEntityNewStockTransfer::class)]
  38.     private $newStockTransfers;
  39.     #[ORM\OneToMany(mappedBy'warehouse'targetEntityStockTransaction::class)]
  40.     private $stockTransactions;
  41.     #[ORM\OneToMany(mappedBy'warehouse'targetEntityInvoice::class)]
  42.     private Collection $invoices;
  43.     public function __construct()
  44.     {
  45.         $this->stocks = new ArrayCollection();
  46.         $this->outgoingTransfers = new ArrayCollection();
  47.         $this->incomingTransfers = new ArrayCollection();
  48.         $this->stockInfos = new ArrayCollection();
  49.         $this->sales = new ArrayCollection();
  50.         $this->newStockTransfers = new ArrayCollection();
  51.         $this->stockTransactions = new ArrayCollection();
  52.         $this->invoices = new ArrayCollection();
  53.     }
  54.     public function __invoke()
  55.     {
  56.         return $this->getId();
  57.     }
  58.     public function __toString(): string
  59.     {
  60.         return $this->getName();
  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 getCountry(): ?string
  76.     {
  77.         return $this->country;
  78.     }
  79.     public function setCountry(string $country): self
  80.     {
  81.         $this->country $country;
  82.         return $this;
  83.     }
  84.     public function getAddress(): ?string
  85.     {
  86.         return $this->address;
  87.     }
  88.     public function setAddress(?string $address): self
  89.     {
  90.         $this->address $address;
  91.         return $this;
  92.     }
  93.     public function getPhone(): ?string
  94.     {
  95.         return $this->phone;
  96.     }
  97.     public function setPhone(?string $phone): self
  98.     {
  99.         $this->phone $phone;
  100.         return $this;
  101.     }
  102.     public function getFax(): ?string
  103.     {
  104.         return $this->fax;
  105.     }
  106.     public function setFax(?string $fax): self
  107.     {
  108.         $this->fax $fax;
  109.         return $this;
  110.     }
  111.     /**
  112.      * @return Collection<int, Stock>
  113.      */
  114.     public function getStocks(): Collection
  115.     {
  116.         return $this->stocks;
  117.     }
  118.     public function addStock(Stock $stock): self
  119.     {
  120.         if (!$this->stocks->contains($stock)) {
  121.             $this->stocks[] = $stock;
  122.             $stock->setWarehouse($this);
  123.         }
  124.         return $this;
  125.     }
  126.     public function removeStock(Stock $stock): self
  127.     {
  128.         if ($this->stocks->removeElement($stock)) {
  129.             // set the owning side to null (unless already changed)
  130.             if ($stock->getWarehouse() === $this) {
  131.                 $stock->setWarehouse(null);
  132.             }
  133.         }
  134.         return $this;
  135.     }
  136.     /**
  137.      * @return Collection<int, StockTransfer>
  138.      */
  139.     public function getOutgoingTransfers(): Collection
  140.     {
  141.         return $this->outgoingTransfers;
  142.     }
  143.     public function addOutgoingTransfer(StockTransfer $outgoingTransfer): self
  144.     {
  145.         if (!$this->outgoingTransfers->contains($outgoingTransfer)) {
  146.             $this->outgoingTransfers[] = $outgoingTransfer;
  147.             $outgoingTransfer->setOutWarehouse($this);
  148.         }
  149.         return $this;
  150.     }
  151.     public function removeOutgoingTransfer(StockTransfer $outgoingTransfer): self
  152.     {
  153.         if ($this->outgoingTransfers->removeElement($outgoingTransfer)) {
  154.             // set the owning side to null (unless already changed)
  155.             if ($outgoingTransfer->getOutWarehouse() === $this) {
  156.                 $outgoingTransfer->setOutWarehouse(null);
  157.             }
  158.         }
  159.         return $this;
  160.     }
  161.     /**
  162.      * @return Collection<int, StockTransfer>
  163.      */
  164.     public function getIncomingTransfers(): Collection
  165.     {
  166.         return $this->incomingTransfers;
  167.     }
  168.     public function addIncomingTransfer(StockTransfer $incomingTransfer): self
  169.     {
  170.         if (!$this->incomingTransfers->contains($incomingTransfer)) {
  171.             $this->incomingTransfers[] = $incomingTransfer;
  172.             $incomingTransfer->setArrivalWarehouse($this);
  173.         }
  174.         return $this;
  175.     }
  176.     public function removeIncomingTransfer(StockTransfer $incomingTransfer): self
  177.     {
  178.         if ($this->incomingTransfers->removeElement($incomingTransfer)) {
  179.             // set the owning side to null (unless already changed)
  180.             if ($incomingTransfer->getArrivalWarehouse() === $this) {
  181.                 $incomingTransfer->setArrivalWarehouse(null);
  182.             }
  183.         }
  184.         return $this;
  185.     }
  186.     /**
  187.      * @return Collection<int, StockInfo>
  188.      */
  189.     public function getStockInfos(): Collection
  190.     {
  191.         return $this->stockInfos;
  192.     }
  193.     public function addStockInfo(StockInfo $stockInfo): self
  194.     {
  195.         if (!$this->stockInfos->contains($stockInfo)) {
  196.             $this->stockInfos[] = $stockInfo;
  197.             $stockInfo->setWarehouse($this);
  198.         }
  199.         return $this;
  200.     }
  201.     public function removeStockInfo(StockInfo $stockInfo): self
  202.     {
  203.         if ($this->stockInfos->removeElement($stockInfo)) {
  204.             // set the owning side to null (unless already changed)
  205.             if ($stockInfo->getWarehouse() === $this) {
  206.                 $stockInfo->setWarehouse(null);
  207.             }
  208.         }
  209.         return $this;
  210.     }
  211.     /**
  212.      * @return Collection<int, Sales>
  213.      */
  214.     public function getSales(): Collection
  215.     {
  216.         return $this->sales;
  217.     }
  218.     public function addSale(Sales $sale): self
  219.     {
  220.         if (!$this->sales->contains($sale)) {
  221.             $this->sales[] = $sale;
  222.             $sale->setWarehouse($this);
  223.         }
  224.         return $this;
  225.     }
  226.     public function removeSale(Sales $sale): self
  227.     {
  228.         if ($this->sales->removeElement($sale)) {
  229.             // set the owning side to null (unless already changed)
  230.             if ($sale->getWarehouse() === $this) {
  231.                 $sale->setWarehouse(null);
  232.             }
  233.         }
  234.         return $this;
  235.     }
  236.     public function getIsMainWarehouse(): ?float
  237.     {
  238.         return $this->isMainWarehouse;
  239.     }
  240.     public function setIsMainWarehouse(float $isMainWarehouse): self
  241.     {
  242.         $this->isMainWarehouse $isMainWarehouse;
  243.         return $this;
  244.     }
  245.     /**
  246.      * @return Collection<int, NewStockTransfer>
  247.      */
  248.     public function getNewStockTransfers(): Collection
  249.     {
  250.         return $this->newStockTransfers;
  251.     }
  252.     public function addNewStockTransfer(NewStockTransfer $newStockTransfer): self
  253.     {
  254.         if (!$this->newStockTransfers->contains($newStockTransfer)) {
  255.             $this->newStockTransfers[] = $newStockTransfer;
  256.             $newStockTransfer->setArrivalWarehouse($this);
  257.         }
  258.         return $this;
  259.     }
  260.     public function removeNewStockTransfer(NewStockTransfer $newStockTransfer): self
  261.     {
  262.         if ($this->newStockTransfers->removeElement($newStockTransfer)) {
  263.             // set the owning side to null (unless already changed)
  264.             if ($newStockTransfer->getArrivalWarehouse() === $this) {
  265.                 $newStockTransfer->setArrivalWarehouse(null);
  266.             }
  267.         }
  268.         return $this;
  269.     }
  270.     /**
  271.      * @return Collection<int, StockTransaction>
  272.      */
  273.     public function getStockTransactions(): Collection
  274.     {
  275.         return $this->stockTransactions;
  276.     }
  277.     public function addStockTransaction(StockTransaction $stockTransaction): self
  278.     {
  279.         if (!$this->stockTransactions->contains($stockTransaction)) {
  280.             $this->stockTransactions[] = $stockTransaction;
  281.             $stockTransaction->setWarehouse($this);
  282.         }
  283.         return $this;
  284.     }
  285.     public function removeStockTransaction(StockTransaction $stockTransaction): self
  286.     {
  287.         if ($this->stockTransactions->removeElement($stockTransaction)) {
  288.             // set the owning side to null (unless already changed)
  289.             if ($stockTransaction->getWarehouse() === $this) {
  290.                 $stockTransaction->setWarehouse(null);
  291.             }
  292.         }
  293.         return $this;
  294.     }
  295.     /**
  296.      * @return Collection<int, Invoice>
  297.      */
  298.     public function getInvoices(): Collection
  299.     {
  300.         return $this->invoices;
  301.     }
  302.     public function addInvoice(Invoice $invoice): static
  303.     {
  304.         if (!$this->invoices->contains($invoice)) {
  305.             $this->invoices->add($invoice);
  306.             $invoice->setWarehouse($this);
  307.         }
  308.         return $this;
  309.     }
  310.     public function removeInvoice(Invoice $invoice): static
  311.     {
  312.         if ($this->invoices->removeElement($invoice)) {
  313.             // set the owning side to null (unless already changed)
  314.             if ($invoice->getWarehouse() === $this) {
  315.                 $invoice->setWarehouse(null);
  316.             }
  317.         }
  318.         return $this;
  319.     }
  320. }