src/Entity/Addresses.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AddressesRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. /**
  9.  * @ORM\Entity(repositoryClass=AddressesRepository::class)
  10.  */
  11. class Addresses
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      * @Groups({
  18.      *     "address.base",
  19.      *     "address.core",
  20.      *
  21.      *     "address@core"
  22.      * })
  23.      */
  24.     private $id;
  25.     /**
  26.      * @ORM\ManyToOne(targetEntity=Suppliers::class, inversedBy="adresses")
  27.      */
  28.     private $supplier;
  29.     /**
  30.      * @ORM\Column(type="string", length=255, nullable=true)
  31.      * @Groups({
  32.      *     "address.base",
  33.      *     "address.core",
  34.      *
  35.      *     "address@core"
  36.      *   })
  37.      */
  38.     private $street;
  39.     /**
  40.      * @ORM\Column(type="string", length=255, nullable=true)
  41.      *  @Groups({
  42.      *     "address.base",
  43.      *     "address.core",
  44.      *
  45.      *     "address@core"
  46.      *
  47.      *   })
  48.      */
  49.     private $code_postal;
  50.     /**
  51.      * @ORM\Column(type="string", length=64, nullable=true)
  52.      * @Groups({
  53.      *     "address.base",
  54.      *     "address.core",
  55.      *
  56.      *     "address@core"
  57.      *   })
  58.      */
  59.     private $city;
  60.     /**
  61.      * @ORM\ManyToOne(targetEntity=Countries::class, inversedBy="adresses")
  62.      * @Groups({
  63.      *     "address.base",
  64.      *     "address.core",
  65.      *
  66.      *     "address@country"
  67.      *   })
  68.      */
  69.     private $country;
  70.     /**
  71.      * @ORM\ManyToOne(targetEntity=AddressTypes::class, inversedBy="addresses")
  72.      * @Groups({
  73.      *     "address.base",
  74.      *     "address.type",
  75.      *
  76.      *     "address@address_type"
  77.      *   })
  78.      */
  79.     private $address_type;
  80.     /**
  81.      * @ORM\OneToMany(targetEntity=Suppliers::class, mappedBy="address")
  82.      */
  83.     private $suppliers;
  84.     /**
  85.      * TODO deprecated remove forever
  86.      * @deprecated use never
  87.      * @ORM\OneToMany(targetEntity=ProductionLocation::class, mappedBy="address")
  88.      */
  89.     private $productionLocations;
  90.     public function __construct()
  91.     {
  92.         $this->suppliers = new ArrayCollection();
  93.         $this->productionLocations = new ArrayCollection();
  94.     }
  95.     public function getId(): ?int
  96.     {
  97.         return $this->id;
  98.     }
  99.     public function getSupplier(): ?Suppliers
  100.     {
  101.         return $this->supplier;
  102.     }
  103.     public function setSupplier(?Suppliers $supplier): self
  104.     {
  105.         $this->supplier $supplier;
  106.         return $this;
  107.     }
  108.     public function getStreet(): ?string
  109.     {
  110.         return $this->street;
  111.     }
  112.     public function setStreet(?string $street): self
  113.     {
  114.         $this->street $street;
  115.         return $this;
  116.     }
  117.     public function getCodePostal(): ?string
  118.     {
  119.         return $this->code_postal;
  120.     }
  121.     public function setCodePostal(?string $code_postal): self
  122.     {
  123.         $this->code_postal $code_postal;
  124.         return $this;
  125.     }
  126.     public function getCity(): ?string
  127.     {
  128.         return $this->city;
  129.     }
  130.     public function setCity(?string $city): self
  131.     {
  132.         $this->city $city;
  133.         return $this;
  134.     }
  135.     public function getCountry(): ?Countries
  136.     {
  137.         return $this->country;
  138.     }
  139.     public function setCountry(?Countries $country): self
  140.     {
  141.         $this->country $country;
  142.         return $this;
  143.     }
  144.     public function getAddressType(): ?AddressTypes
  145.     {
  146.         return $this->address_type;
  147.     }
  148.     public function setAddressType(?AddressTypes $address_type): self
  149.     {
  150.         $this->address_type $address_type;
  151.         return $this;
  152.     }
  153.     /**
  154.      * @return Collection<int, Suppliers>
  155.      */
  156.     public function getSuppliers(): Collection
  157.     {
  158.         return $this->suppliers;
  159.     }
  160.     public function addSupplier(Suppliers $supplier): self
  161.     {
  162.         if (!$this->suppliers->contains($supplier)) {
  163.             $this->suppliers[] = $supplier;
  164.             $supplier->setAddress($this);
  165.         }
  166.         return $this;
  167.     }
  168.     public function removeSupplier(Suppliers $supplier): self
  169.     {
  170.         if ($this->suppliers->removeElement($supplier)) {
  171.             // set the owning side to null (unless already changed)
  172.             if ($supplier->getAddress() === $this) {
  173.                 $supplier->setAddress(null);
  174.             }
  175.         }
  176.         return $this;
  177.     }
  178.     /**
  179.      *
  180.      * TODO deprecated remove forever
  181.      * @deprecated use never
  182.      * @return Collection<int, ProductionLocation>
  183.      */
  184.     public function getProductionLocations(): Collection
  185.     {
  186.         return $this->productionLocations;
  187.     }
  188.     /**
  189.      * TODO deprecated remove forever
  190.      * @deprecated use never
  191.      */
  192.     public function addProductionLocation(ProductionLocation $productionLocation): self
  193.     {
  194.         if (!$this->productionLocations->contains($productionLocation)) {
  195.             $this->productionLocations[] = $productionLocation;
  196.             $productionLocation->setAddress($this);
  197.         }
  198.         return $this;
  199.     }
  200.     /**
  201.      * TODO deprecated remove forever
  202.      * @deprecated use never
  203.     */
  204.     public function removeProductionLocation(ProductionLocation $productionLocation): self
  205.     {
  206.         if ($this->productionLocations->removeElement($productionLocation)) {
  207.             // set the owning side to null (unless already changed)
  208.             if ($productionLocation->getAddress() === $this) {
  209.                 $productionLocation->setAddress(null);
  210.             }
  211.         }
  212.         return $this;
  213.     }
  214. }