<?php
namespace App\Entity;
use App\Repository\AddressesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=AddressesRepository::class)
*/
class Addresses
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({
* "address.base",
* "address.core"
* })
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Suppliers::class, inversedBy="adresses")
*/
private $supplier;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({
* "address.base",
* "address.core"
* })
*/
private $street;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({
* "address.base",
* "address.core"
* })
*/
private $code_postal;
/**
* @ORM\Column(type="string", length=64, nullable=true)
* @Groups({
* "address.base",
* "address.core"
* })
*/
private $city;
/**
* @ORM\ManyToOne(targetEntity=Countries::class, inversedBy="adresses")
* @Groups({
* "address.base",
* "address.core"
* })
*/
private $country;
/**
* @ORM\ManyToOne(targetEntity=AddressTypes::class, inversedBy="addresses")
* @Groups({
* "address.base",
* "address.type"
* })
*/
private $address_type;
/**
* @ORM\OneToMany(targetEntity=Suppliers::class, mappedBy="address")
*/
private $suppliers;
/**
* @ORM\OneToMany(targetEntity=ProductionLocation::class, mappedBy="address")
*/
private $productionLocations;
public function __construct()
{
$this->suppliers = new ArrayCollection();
$this->productionLocations = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getSupplier(): ?Suppliers
{
return $this->supplier;
}
public function setSupplier(?Suppliers $supplier): self
{
$this->supplier = $supplier;
return $this;
}
public function getStreet(): ?string
{
return $this->street;
}
public function setStreet(?string $street): self
{
$this->street = $street;
return $this;
}
public function getCodePostal(): ?string
{
return $this->code_postal;
}
public function setCodePostal(?string $code_postal): self
{
$this->code_postal = $code_postal;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): self
{
$this->city = $city;
return $this;
}
public function getCountry(): ?Countries
{
return $this->country;
}
public function setCountry(?Countries $country): self
{
$this->country = $country;
return $this;
}
public function getAddressType(): ?AddressTypes
{
return $this->address_type;
}
public function setAddressType(?AddressTypes $address_type): self
{
$this->address_type = $address_type;
return $this;
}
/**
* @return Collection<int, Suppliers>
*/
public function getSuppliers(): Collection
{
return $this->suppliers;
}
public function addSupplier(Suppliers $supplier): self
{
if (!$this->suppliers->contains($supplier)) {
$this->suppliers[] = $supplier;
$supplier->setAddress($this);
}
return $this;
}
public function removeSupplier(Suppliers $supplier): self
{
if ($this->suppliers->removeElement($supplier)) {
// set the owning side to null (unless already changed)
if ($supplier->getAddress() === $this) {
$supplier->setAddress(null);
}
}
return $this;
}
/**
* @return Collection<int, ProductionLocation>
*/
public function getProductionLocations(): Collection
{
return $this->productionLocations;
}
public function addProductionLocation(ProductionLocation $productionLocation): self
{
if (!$this->productionLocations->contains($productionLocation)) {
$this->productionLocations[] = $productionLocation;
$productionLocation->setAddress($this);
}
return $this;
}
public function removeProductionLocation(ProductionLocation $productionLocation): self
{
if ($this->productionLocations->removeElement($productionLocation)) {
// set the owning side to null (unless already changed)
if ($productionLocation->getAddress() === $this) {
$productionLocation->setAddress(null);
}
}
return $this;
}
}