src/Entity/Supplier.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Doctrine\Common\Collections\Collection;
  5. use Symfony\Component\HttpFoundation\File\File;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. /**
  10.  * @Vich\Uploadable
  11.  * @ORM\Entity(repositoryClass="App\Repository\SupplierRepository")
  12.  */
  13. class Supplier
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      * @Groups({"stock_edit", "supplier_edit"})
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      * @Groups({"stock_edit", "supplier_edit"})
  25.      */
  26.     private $company;
  27.     /**
  28.      * @ORM\Column(type="string", length=255, nullable=true)
  29.      * @Groups({"supplier_edit"})
  30.      */
  31.     private $finishedProductsOrder;
  32.     /**
  33.      * @ORM\Column(type="string", length=255, nullable=true)
  34.      * @Groups({"supplier_edit"})
  35.      */
  36.     private $sparePartsDepartment;
  37.     /**
  38.      * @ORM\Column(type="string", length=255, nullable=true)
  39.      * @Groups({"supplier_edit"})
  40.      */
  41.     private $managerName;
  42.     /**
  43.      * @ORM\Column(type="string", length=255, nullable=true)
  44.      * @Groups({"supplier_edit"})
  45.      */
  46.     private $managerPhoneNumber;
  47.     /**
  48.      * @ORM\Column(type="string", length=255, nullable=true)
  49.      * @Groups({"supplier_edit"})
  50.      */
  51.     private $managerEmail;
  52.     /**
  53.      * @ORM\Column(type="string", length=255, nullable=true)
  54.      * @Groups({"supplier_edit"})
  55.      */
  56.     private $areaManagerName;
  57.     /**
  58.      * @ORM\Column(type="string", length=255, nullable=true)
  59.      * @Groups({"supplier_edit"})
  60.      */
  61.     private $areaManagerPhoneNumber;
  62.     /**
  63.      * @ORM\Column(type="string", length=255, nullable=true)
  64.      * @Groups({"supplier_edit"})
  65.      */
  66.     private $areaManagerEmail;
  67.     /**
  68.      * @ORM\Column(type="string", length=255, nullable=true)
  69.      * @Groups({"supplier_edit"})
  70.      */
  71.     private $hotlinePhoneNumber;
  72.     /**
  73.      * @ORM\Column(type="string", length=255, nullable=true)
  74.      * @Groups({"supplier_edit"})
  75.      */
  76.     private $hotlineEmail;
  77.     /**
  78.      * @ORM\OneToMany(targetEntity=Stock::class, mappedBy="supplier")
  79.      */
  80.     private $stocks;
  81.     /**
  82.      * @ORM\OneToMany(targetEntity=Brand::class, mappedBy="supplier")
  83.      */
  84.     private $brands;
  85.     /**
  86.      * @ORM\Column(type="string", length=255, nullable=true)
  87.      * @Groups({"supplier_edit"})
  88.      * @var string|null
  89.      */
  90.     private $logo;
  91.     /**
  92.      * @Vich\UploadableField(mapping="suppliers", fileNameProperty="logo", size="logoSize")
  93.      * @Groups({"supplier_edit"})
  94.      * @var File|null
  95.      */
  96.     private $logoFile;
  97.     /**
  98.      * @ORM\Column(type="string", length=255, nullable=true)
  99.      * @Groups({"supplier_edit"})
  100.      */
  101.     private $websiteLink;
  102.     /**
  103.      * @ORM\Column(type="integer", nullable=true)
  104.      */
  105.     private $logoSize;
  106.     /**
  107.      * @ORM\Column(type="datetime_immutable", nullable=true)
  108.      */
  109.     private $updatedAt;
  110.     public function __construct()
  111.     {
  112.         $this->stocks = new ArrayCollection();
  113.         $this->brands = new ArrayCollection();
  114.     }
  115.     public function __toString(): string
  116.     {
  117.         return $this->company;
  118.     }
  119.     public function getId(): ?int
  120.     {
  121.         return $this->id;
  122.     }
  123.     public function getCompany(): ?string
  124.     {
  125.         return $this->company;
  126.     }
  127.     public function setCompany(string $company): self
  128.     {
  129.         $this->company $company;
  130.         return $this;
  131.     }
  132.     public function getFinishedProductsOrder(): ?string
  133.     {
  134.         return $this->finishedProductsOrder;
  135.     }
  136.     public function setFinishedProductsOrder(?string $finishedProductsOrder): self
  137.     {
  138.         $this->finishedProductsOrder $finishedProductsOrder;
  139.         return $this;
  140.     }
  141.     public function getSparePartsDepartment(): ?string
  142.     {
  143.         return $this->sparePartsDepartment;
  144.     }
  145.     public function setSparePartsDepartment(?string $sparePartsDepartment): self
  146.     {
  147.         $this->sparePartsDepartment $sparePartsDepartment;
  148.         return $this;
  149.     }
  150.     public function getManagerName(): ?string
  151.     {
  152.         return $this->managerName;
  153.     }
  154.     public function setManagerName(?string $managerName): self
  155.     {
  156.         $this->managerName $managerName;
  157.         return $this;
  158.     }
  159.     public function getAreaManagerName(): ?string
  160.     {
  161.         return $this->areaManagerName;
  162.     }
  163.     public function setAreaManagerName(?string $areaManagerName): self
  164.     {
  165.         $this->areaManagerName $areaManagerName;
  166.         return $this;
  167.     }
  168.     public function getAreaManagerEmail(): ?string
  169.     {
  170.         return $this->areaManagerEmail;
  171.     }
  172.     public function setAreaManagerEmail(?string $areaManagerEmail): self
  173.     {
  174.         $this->areaManagerEmail $areaManagerEmail;
  175.         return $this;
  176.     }
  177.     public function getManagerEmail(): ?string
  178.     {
  179.         return $this->managerEmail;
  180.     }
  181.     public function setManagerEmail(?string $managerEmail): self
  182.     {
  183.         $this->managerEmail $managerEmail;
  184.         return $this;
  185.     }
  186.     public function getHotlinePhoneNumber(): ?string
  187.     {
  188.         return $this->hotlinePhoneNumber;
  189.     }
  190.     public function setHotlinePhoneNumber(?string $hotlinePhoneNumber): self
  191.     {
  192.         $this->hotlinePhoneNumber $hotlinePhoneNumber;
  193.         return $this;
  194.     }
  195.     public function getHotlineEmail(): ?string
  196.     {
  197.         return $this->hotlineEmail;
  198.     }
  199.     public function setHotlineEmail(?string $hotlineEmail): self
  200.     {
  201.         $this->hotlineEmail $hotlineEmail;
  202.         return $this;
  203.     }
  204.     /**
  205.      * @return Collection<int, Stock>
  206.      */
  207.     public function getStocks(): Collection
  208.     {
  209.         return $this->stocks;
  210.     }
  211.     public function addStock(Stock $stock): self
  212.     {
  213.         if (!$this->stocks->contains($stock)) {
  214.             $this->stocks[] = $stock;
  215.             $stock->setSupplier($this);
  216.         }
  217.         return $this;
  218.     }
  219.     public function removeStock(Stock $stock): self
  220.     {
  221.         if ($this->stocks->removeElement($stock)) {
  222.             // set the owning side to null (unless already changed)
  223.             if ($stock->getSupplier() === $this) {
  224.                 $stock->setSupplier(null);
  225.             }
  226.         }
  227.         return $this;
  228.     }
  229.     /**
  230.      * @return Collection<int, Brand>
  231.      */
  232.     public function getBrands(): Collection
  233.     {
  234.         return $this->brands;
  235.     }
  236.     public function addBrand(Brand $brand): self
  237.     {
  238.         if (!$this->brands->contains($brand)) {
  239.             $this->brands[] = $brand;
  240.             $brand->setSupplier($this);
  241.         }
  242.         return $this;
  243.     }
  244.     public function removeBrand(Brand $brand): self
  245.     {
  246.         if ($this->brands->removeElement($brand)) {
  247.             // set the owning side to null (unless already changed)
  248.             if ($brand->getSupplier() === $this) {
  249.                 $brand->setSupplier(null);
  250.             }
  251.         }
  252.         return $this;
  253.     }
  254.     public function getLogo(): ?string
  255.     {
  256.         return $this->logo;
  257.     }
  258.     public function setLogo(?string $logo): self
  259.     {
  260.         $this->logo $logo;
  261.         return $this;
  262.     }
  263.     public function getWebsiteLink(): ?string
  264.     {
  265.         return $this->websiteLink;
  266.     }
  267.     public function setWebsiteLink(?string $websiteLink): self
  268.     {
  269.         $this->websiteLink $websiteLink;
  270.         return $this;
  271.     }
  272.     public function getLogoSize(): ?int
  273.     {
  274.         return $this->logoSize;
  275.     }
  276.     public function setLogoSize(?int $logoSize): self
  277.     {
  278.         $this->logoSize $logoSize;
  279.         return $this;
  280.     }
  281.     public function getUpdatedAt(): ?\DateTimeImmutable
  282.     {
  283.         return $this->updatedAt;
  284.     }
  285.     public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
  286.     {
  287.         $this->updatedAt $updatedAt;
  288.         return $this;
  289.     }
  290.     public function setLogoFile(?File $logoFile null): void
  291.     {
  292.         $this->logoFile $logoFile;
  293.         if (null !== $logoFile) {
  294.             // It is required that at least one field changes if you are using doctrine
  295.             // otherwise the event listeners won't be called and the file is lost
  296.             $this->updatedAt = new \DateTimeImmutable();
  297.         }
  298.     }
  299.     public function getLogoFile(): ?File
  300.     {
  301.         return $this->logoFile;
  302.     }
  303.     public function getManagerPhoneNumber(): ?string
  304.     {
  305.         return $this->managerPhoneNumber;
  306.     }
  307.     public function setManagerPhoneNumber(?string $managerPhoneNumber): self
  308.     {
  309.         $this->managerPhoneNumber $managerPhoneNumber;
  310.         return $this;
  311.     }
  312.     public function getAreaManagerPhoneNumber(): ?string
  313.     {
  314.         return $this->areaManagerPhoneNumber;
  315.     }
  316.     public function setAreaManagerPhoneNumber(?string $areaManagerPhoneNumber): self
  317.     {
  318.         $this->areaManagerPhoneNumber $areaManagerPhoneNumber;
  319.         return $this;
  320.     }
  321. }