src/Entity/Suppliers.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SuppliersRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use App\Entity\Warehouse;
  8. use phpDocumentor\Reflection\Types\This;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. /**
  11.  * ORM\UniqueConstraint(name="unique_phone_number", columns={"phone_number"}, options={"where": "(phone_number IS NOT NULL)"}),
  12.  * @ORM\Entity(repositoryClass=SuppliersRepository::class)
  13.  * @ORM\Table(
  14.  *       name="suppliers",
  15.  *       uniqueConstraints={
  16.  *           @ORM\UniqueConstraint(columns={"alias", "company"}),
  17.  *       },
  18.  *  )
  19.  */
  20. class Suppliers
  21. {
  22.     /**
  23.      * @ORM\Id
  24.      * @ORM\GeneratedValue
  25.      * @ORM\Column(type="integer")
  26.      * @Groups({
  27.      *          "project.details.orders",
  28.      *          "order.detail",
  29.      *          "supplier.base",
  30.      *          "material.base",
  31.      *
  32.      *          "project.orders.expense.minify.list.version",
  33.      *
  34.      *     "supplier.core", "supplier:core", "supplier@core",
  35.      *     })
  36.      */
  37.     private $id;
  38.     /**
  39.      * @deprecated use company
  40.      * @ORM\Column(type="string", length=255, nullable=true)
  41.      * @Groups({
  42.      *          "project.details.orders",
  43.      *          "order.detail",
  44.      *          "supplier.base",
  45.      *          "material.base",
  46.      *
  47.      *     "supplier.core", "supplier:core", "supplier@core"
  48.      *     })
  49.      */
  50.     private $name;
  51.     /**
  52.      * @ORM\Column(type="string", length=64, nullable=true)
  53.      * @Groups({
  54.      *           "supplier.base",
  55.      *
  56.      *     "supplier.core", "supplier:core", "supplier@core"
  57.      *      })
  58.      */
  59.     private $city;
  60.     /**
  61.      * @ORM\OneToMany(targetEntity=ProjectOrderExtraCosts::class, mappedBy="supplier")
  62.      */
  63.     private $projectOrderExtraCosts;
  64.     /**
  65.      * @ORM\OneToMany(targetEntity=Material::class, mappedBy="supplier")
  66.      */
  67.     private $materials;
  68.     /**
  69.      * @ORM\OneToMany(targetEntity=SupplierOrders::class, mappedBy="supplier")
  70.      */
  71.     private $supplierOrders;
  72.     /**
  73.      * @ORM\OneToMany(targetEntity=ProjectOrderExpenses::class, mappedBy="supplier", orphanRemoval=true)
  74.      */
  75.     private $projectOrderExpenses;
  76.     /**
  77.      * @ORM\Column(type="string", length=64, nullable=true)
  78.      * @Groups({
  79.      *     "supplier.base",
  80.      *     "supplier.expenses"
  81.      * })
  82.      */
  83.     private $alias;
  84.     /**
  85.      * @ORM\Column(type="string", length=64, nullable=true)
  86.      * @Groups({
  87.      *     "supplier.base",
  88.      *     "project.orders.expense.minify.version",
  89.      *     "supplier.core", "supplier:core", "supplier@core"
  90.      * })
  91.      */
  92.     private $company;
  93.     /**
  94.      * @ORM\Column(type="string", length=255, nullable=true)
  95.      * @Groups({
  96.      *     "supplier.base",
  97.      *     "project.orders.expense.minify.list.version",
  98.      *     "supplier.core", "supplier:core", "supplier@core"
  99.      *  })
  100.      */
  101.     private $terms_to_payment;
  102.     /**
  103.      * @ORM\OneToMany(targetEntity=Addresses::class, mappedBy="supplier")
  104.      * @Groups({
  105.      *     "supplier.base",
  106.      *     "supplier.address"
  107.      * })
  108.      */
  109.     private $addresses;
  110.     /**
  111.      * @ORM\ManyToOne(targetEntity=Addresses::class, inversedBy="suppliers")
  112.      * @Groups({
  113.      *     "supplier.base",
  114.      *     "supplier.core", "supplier:core", "supplier@core"
  115.      * })
  116.      * @ORM\JoinColumn(onDelete="SET NULL")
  117.      */
  118.     private $address;
  119.     /**
  120.      * @ORM\Column(type="string", length=64, nullable=true)
  121.      * @Groups({
  122.      *     "supplier.base",
  123.      *     "supplier.core", "supplier:core", "supplier@core"
  124.      * })
  125.      */
  126.     private $tax;
  127.     /**
  128.      * @ORM\Column(type="string", length=255, nullable=true)
  129.      * @Groups({
  130.      *     "supplier.base",
  131.      *     "supplier.core", "supplier:core", "supplier@core"
  132.      * })
  133.      */
  134.     private $email;
  135.     /**
  136.      * @ORM\OneToMany(targetEntity=Stocks::class, mappedBy="supplier")
  137.      */
  138.     private $stocks;
  139.     /**
  140.      * @ORM\OneToMany(targetEntity=SupplierProducts::class, mappedBy="supplier")
  141.      * @Groups({
  142.      *      "supplier.products"
  143.      *  })
  144.      */
  145.     private $supplierProducts;
  146.     public function __construct()
  147.     {
  148.         $this->projectOrderExtraCosts = new ArrayCollection();
  149.         $this->materials = new ArrayCollection();
  150.         $this->supplierOrders = new ArrayCollection();
  151.         $this->projectOrderExpenses = new ArrayCollection();
  152.         $this->addresses = new ArrayCollection();
  153.         $this->stocks = new ArrayCollection();
  154.         $this->supplierProducts = new ArrayCollection();
  155.     }
  156.     public function getId(): ?int
  157.     {
  158.         return $this->id;
  159.     }
  160.     public function getName(): ?string
  161.     {
  162.         return $this->name;
  163.     }
  164.     public function setName(?string $name): self
  165.     {
  166.         $this->name $name;
  167.         return $this;
  168.     }
  169.     public function getCity(): ?string
  170.     {
  171.         return $this->city;
  172.     }
  173.     public function setCity(?string $city): self
  174.     {
  175.         $this->city $city;
  176.         return $this;
  177.     }
  178.     /**
  179.      * @return Collection<int, ProjectOrderExtraCosts>
  180.      */
  181.     public function getProjectOrderExtraCosts(): Collection
  182.     {
  183.         return $this->projectOrderExtraCosts;
  184.     }
  185.     public function addProjectOrderExtraCost(ProjectOrderExtraCosts $projectOrderExtraCost): self
  186.     {
  187.         if (!$this->projectOrderExtraCosts->contains($projectOrderExtraCost)) {
  188.             $this->projectOrderExtraCosts[] = $projectOrderExtraCost;
  189.             $projectOrderExtraCost->setSupplier($this);
  190.         }
  191.         return $this;
  192.     }
  193.     public function removeProjectOrderExtraCost(ProjectOrderExtraCosts $projectOrderExtraCost): self
  194.     {
  195.         if ($this->projectOrderExtraCosts->removeElement($projectOrderExtraCost)) {
  196.             // set the owning side to null (unless already changed)
  197.             if ($projectOrderExtraCost->getSupplier() === $this) {
  198.                 $projectOrderExtraCost->setSupplier(null);
  199.             }
  200.         }
  201.         return $this;
  202.     }
  203.     /**
  204.      * @return Collection<int, Material>
  205.      */
  206.     public function getMaterials(): Collection
  207.     {
  208.         return $this->materials;
  209.     }
  210.     public function addMaterial(Material $material): self
  211.     {
  212.         if (!$this->materials->contains($material)) {
  213.             $this->materials[] = $material;
  214.             $material->setSupplier($this);
  215.         }
  216.         return $this;
  217.     }
  218.     public function removeMaterial(Material $material): self
  219.     {
  220.         if ($this->materials->removeElement($material)) {
  221.             // set the owning side to null (unless already changed)
  222.             if ($material->getSupplier() === $this) {
  223.                 $material->setSupplier(null);
  224.             }
  225.         }
  226.         return $this;
  227.     }
  228.     /**
  229.      * @return Collection<int, SupplierOrders>
  230.      */
  231.     public function getSupplierOrders(): Collection
  232.     {
  233.         return $this->supplierOrders;
  234.     }
  235.     public function addSupplierOrder(SupplierOrders $supplierOrder): self
  236.     {
  237.         if (!$this->supplierOrders->contains($supplierOrder)) {
  238.             $this->supplierOrders[] = $supplierOrder;
  239.             $supplierOrder->setSupplier($this);
  240.         }
  241.         return $this;
  242.     }
  243.     public function removeSupplierOrder(SupplierOrders $supplierOrder): self
  244.     {
  245.         if ($this->supplierOrders->removeElement($supplierOrder)) {
  246.             // set the owning side to null (unless already changed)
  247.             if ($supplierOrder->getSupplier() === $this) {
  248.                 $supplierOrder->setSupplier(null);
  249.             }
  250.         }
  251.         return $this;
  252.     }
  253.     /**
  254.      * @return Collection<int, ProjectOrderExpenses>
  255.      */
  256.     public function getProjectOrderExpenses(): Collection
  257.     {
  258.         return $this->projectOrderExpenses;
  259.     }
  260.     public function addProjectOrderExpense(ProjectOrderExpenses $projectOrderExpense): self
  261.     {
  262.         if (!$this->projectOrderExpenses->contains($projectOrderExpense)) {
  263.             $this->projectOrderExpenses[] = $projectOrderExpense;
  264.             $projectOrderExpense->setSupplier($this);
  265.         }
  266.         return $this;
  267.     }
  268.     public function removeProjectOrderExpense(ProjectOrderExpenses $projectOrderExpense): self
  269.     {
  270.         if ($this->projectOrderExpenses->removeElement($projectOrderExpense)) {
  271.             // set the owning side to null (unless already changed)
  272.             if ($projectOrderExpense->getSupplier() === $this) {
  273.                 $projectOrderExpense->setSupplier(null);
  274.             }
  275.         }
  276.         return $this;
  277.     }
  278.     public function getAlias(): ?string
  279.     {
  280.         return $this->alias;
  281.     }
  282.     public function setAlias(?string $alias): self
  283.     {
  284.         $this->alias $alias;
  285.         return $this;
  286.     }
  287.     public function getCompany(): ?string
  288.     {
  289.         return $this->company;
  290.     }
  291.     public function setCompany(?string $company): self
  292.     {
  293.         $this->company $company;
  294.         return $this;
  295.     }
  296.     public function getTermsToPayment(): ?string
  297.     {
  298.         return $this->terms_to_payment;
  299.     }
  300.     public function setTermsToPayment(?string $terms_to_payment): self
  301.     {
  302.         $this->terms_to_payment $terms_to_payment;
  303.         return $this;
  304.     }
  305.     /**
  306.      * @return Collection<int, Addresses>
  307.      */
  308.     public function getAddresses(): Collection
  309.     {
  310.         return $this->addresses;
  311.     }
  312.     public function addAdress(Addresses $adress): self
  313.     {
  314.         if (!$this->addresses->contains($adress)) {
  315.             $this->addresses[] = $adress;
  316.             $adress->setSupplier($this);
  317.         }
  318.         return $this;
  319.     }
  320.     public function removeAdress(Addresses $adress): self
  321.     {
  322.         if ($this->addresses->removeElement($adress)) {
  323.             // set the owning side to null (unless already changed)
  324.             if ($adress->getSupplier() === $this) {
  325.                 $adress->setSupplier(null);
  326.             }
  327.         }
  328.         return $this;
  329.     }
  330.     public function getAddress(): ?Addresses
  331.     {
  332.         return $this->address;
  333.     }
  334.     public function setAddress(?Addresses $address): self
  335.     {
  336.         $this->address $address;
  337.         return $this;
  338.     }
  339.     public function getTax(): ?string
  340.     {
  341.         return $this->tax;
  342.     }
  343.     public function setTax(?string $tax): self
  344.     {
  345.         $this->tax $tax;
  346.         return $this;
  347.     }
  348.     public function getEmail(): ?string
  349.     {
  350.         return $this->email;
  351.     }
  352.     public function setEmail(?string $email): self
  353.     {
  354.         $this->email $email;
  355.         return $this;
  356.     }
  357.     /**
  358.      * @return Collection<int, Stocks>
  359.      */
  360.     public function getStocks(): Collection
  361.     {
  362.         return $this->stocks;
  363.     }
  364.     public function addStock(Stocks $stock): self
  365.     {
  366.         if (!$this->stocks->contains($stock)) {
  367.             $this->stocks[] = $stock;
  368.             $stock->setSupplier($this);
  369.         }
  370.         return $this;
  371.     }
  372.     public function removeStock(Stocks $stock): self
  373.     {
  374.         if ($this->stocks->removeElement($stock)) {
  375.             // set the owning side to null (unless already changed)
  376.             if ($stock->getSupplier() === $this) {
  377.                 $stock->setSupplier(null);
  378.             }
  379.         }
  380.         return $this;
  381.     }
  382.     /**
  383.      * @return Collection<int, SupplierProducts>
  384.      */
  385.     public function getSupplierProducts(): Collection
  386.     {
  387.         return $this->supplierProducts;
  388.     }
  389.     public function addSupplierProduct(SupplierProducts $supplierProduct): self
  390.     {
  391.         if (!$this->supplierProducts->contains($supplierProduct)) {
  392.             $this->supplierProducts[] = $supplierProduct;
  393.             $supplierProduct->setSupplier($this);
  394.         }
  395.         return $this;
  396.     }
  397.     public function removeSupplierProduct(SupplierProducts $supplierProduct): self
  398.     {
  399.         if ($this->supplierProducts->removeElement($supplierProduct)) {
  400.             // set the owning side to null (unless already changed)
  401.             if ($supplierProduct->getSupplier() === $this) {
  402.                 $supplierProduct->setSupplier(null);
  403.             }
  404.         }
  405.         return $this;
  406.     }
  407. }