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.      */
  22.     private $id;
  23.     /**
  24.      * @ORM\ManyToOne(targetEntity=Suppliers::class, inversedBy="adresses")
  25.      */
  26.     private $supplier;
  27.     /**
  28.      * @ORM\Column(type="string", length=255, nullable=true)
  29.      * @Groups({
  30.      *     "address.base",
  31.      *     "address.core"
  32.      *   })
  33.      */
  34.     private $street;
  35.     /**
  36.      * @ORM\Column(type="string", length=255, nullable=true)
  37.      *  @Groups({
  38.      *     "address.base",
  39.      *     "address.core"
  40.      *   })
  41.      */
  42.     private $code_postal;
  43.     /**
  44.      * @ORM\Column(type="string", length=64, nullable=true)
  45.      * @Groups({
  46.      *     "address.base",
  47.      *     "address.core"
  48.      *   })
  49.      */
  50.     private $city;
  51.     /**
  52.      * @ORM\ManyToOne(targetEntity=Countries::class, inversedBy="adresses")
  53.      * @Groups({
  54.      *     "address.base",
  55.      *     "address.core"
  56.      *   })
  57.      */
  58.     private $country;
  59.     /**
  60.      * @ORM\ManyToOne(targetEntity=AddressTypes::class, inversedBy="addresses")
  61.      * @Groups({
  62.      *     "address.base",
  63.      *     "address.type"
  64.      *   })
  65.      */
  66.     private $address_type;
  67.     /**
  68.      * @ORM\OneToMany(targetEntity=Suppliers::class, mappedBy="address")
  69.      */
  70.     private $suppliers;
  71.     /**
  72.      * @ORM\OneToMany(targetEntity=ProductionLocation::class, mappedBy="address")
  73.      */
  74.     private $productionLocations;
  75.     public function __construct()
  76.     {
  77.         $this->suppliers = new ArrayCollection();
  78.         $this->productionLocations = new ArrayCollection();
  79.     }
  80.     public function getId(): ?int
  81.     {
  82.         return $this->id;
  83.     }
  84.     public function getSupplier(): ?Suppliers
  85.     {
  86.         return $this->supplier;
  87.     }
  88.     public function setSupplier(?Suppliers $supplier): self
  89.     {
  90.         $this->supplier $supplier;
  91.         return $this;
  92.     }
  93.     public function getStreet(): ?string
  94.     {
  95.         return $this->street;
  96.     }
  97.     public function setStreet(?string $street): self
  98.     {
  99.         $this->street $street;
  100.         return $this;
  101.     }
  102.     public function getCodePostal(): ?string
  103.     {
  104.         return $this->code_postal;
  105.     }
  106.     public function setCodePostal(?string $code_postal): self
  107.     {
  108.         $this->code_postal $code_postal;
  109.         return $this;
  110.     }
  111.     public function getCity(): ?string
  112.     {
  113.         return $this->city;
  114.     }
  115.     public function setCity(?string $city): self
  116.     {
  117.         $this->city $city;
  118.         return $this;
  119.     }
  120.     public function getCountry(): ?Countries
  121.     {
  122.         return $this->country;
  123.     }
  124.     public function setCountry(?Countries $country): self
  125.     {
  126.         $this->country $country;
  127.         return $this;
  128.     }
  129.     public function getAddressType(): ?AddressTypes
  130.     {
  131.         return $this->address_type;
  132.     }
  133.     public function setAddressType(?AddressTypes $address_type): self
  134.     {
  135.         $this->address_type $address_type;
  136.         return $this;
  137.     }
  138.     /**
  139.      * @return Collection<int, Suppliers>
  140.      */
  141.     public function getSuppliers(): Collection
  142.     {
  143.         return $this->suppliers;
  144.     }
  145.     public function addSupplier(Suppliers $supplier): self
  146.     {
  147.         if (!$this->suppliers->contains($supplier)) {
  148.             $this->suppliers[] = $supplier;
  149.             $supplier->setAddress($this);
  150.         }
  151.         return $this;
  152.     }
  153.     public function removeSupplier(Suppliers $supplier): self
  154.     {
  155.         if ($this->suppliers->removeElement($supplier)) {
  156.             // set the owning side to null (unless already changed)
  157.             if ($supplier->getAddress() === $this) {
  158.                 $supplier->setAddress(null);
  159.             }
  160.         }
  161.         return $this;
  162.     }
  163.     /**
  164.      * @return Collection<int, ProductionLocation>
  165.      */
  166.     public function getProductionLocations(): Collection
  167.     {
  168.         return $this->productionLocations;
  169.     }
  170.     public function addProductionLocation(ProductionLocation $productionLocation): self
  171.     {
  172.         if (!$this->productionLocations->contains($productionLocation)) {
  173.             $this->productionLocations[] = $productionLocation;
  174.             $productionLocation->setAddress($this);
  175.         }
  176.         return $this;
  177.     }
  178.     public function removeProductionLocation(ProductionLocation $productionLocation): self
  179.     {
  180.         if ($this->productionLocations->removeElement($productionLocation)) {
  181.             // set the owning side to null (unless already changed)
  182.             if ($productionLocation->getAddress() === $this) {
  183.                 $productionLocation->setAddress(null);
  184.             }
  185.         }
  186.         return $this;
  187.     }
  188. }