<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\CustomerAddressRepository")
*/
class CustomerAddress
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $zipCode;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $city;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $street;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $propertyNumber;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $apartmentNumber;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Customer", inversedBy="addresses", cascade={"remove","persist"})
* @ORM\JoinColumn(name="customer_id", referencedColumnName="id", nullable=false)
*/
private $customer;
/**
* @ORM\Column(type="boolean")
*/
private $defaultAddress = false;
public function getId(): ?int
{
return $this->id;
}
public function getApartmentNumber()
{
return $this->apartmentNumber;
}
public function getCity()
{
return $this->city;
}
public function getPropertyNumber()
{
return $this->propertyNumber;
}
public function getStreet()
{
return $this->street;
}
public function getZipCode()
{
return $this->zipCode;
}
public function setApartmentNumber($apartmentNumber)
{
$this->apartmentNumber = $apartmentNumber;
}
public function setCity($city)
{
$this->city = $city;
}
public function setPropertyNumber($propertyNumber)
{
$this->propertyNumber = $propertyNumber;
}
public function setStreet($street)
{
$this->street = $street;
}
public function setZipCode($zipCode)
{
$this->zipCode = $zipCode;
}
public function getCustomer(): Customer
{
return $this->customer;
}
public function setCustomer(Customer $customer): self
{
$this->customer = $customer;
return $this;
}
public function isDefaultAddress()
{
return $this->defaultAddress;
}
public function setDefaultAddress($defaultAddress)
{
$this->defaultAddress = $defaultAddress;
}
public function __toString()
{
$address = $this->zipCode . ' ' . $this->city . ', ' . $this->street . ' ' . $this->propertyNumber;
$address .= ($this->apartmentNumber != '') ? '/' . $this->apartmentNumber : '';
return $address;
}
}