src/Entity/CustomerAddress.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5.  * @ORM\Entity(repositoryClass="App\Repository\CustomerAddressRepository")
  6.  */
  7. class CustomerAddress
  8. {
  9.     /**
  10.      * @ORM\Id()
  11.      * @ORM\GeneratedValue()
  12.      * @ORM\Column(type="integer")
  13.      */
  14.     private $id;
  15.     /**
  16.      * @ORM\Column(type="string", length=255, nullable=true)
  17.      */
  18.     private $zipCode;
  19.     /**
  20.      * @ORM\Column(type="string", length=255, nullable=true)
  21.      */
  22.     private $city;
  23.     /**
  24.      * @ORM\Column(type="string", length=255, nullable=true)
  25.      */
  26.     private $street;
  27.     /**
  28.      * @ORM\Column(type="string", length=255, nullable=true)
  29.      */
  30.     private $propertyNumber;
  31.     /**
  32.      * @ORM\Column(type="string", length=255, nullable=true)
  33.      */
  34.     private $apartmentNumber;
  35.     /**
  36.      * @ORM\ManyToOne(targetEntity="App\Entity\Customer", inversedBy="addresses", cascade={"remove","persist"})
  37.      * @ORM\JoinColumn(name="customer_id", referencedColumnName="id", nullable=false)
  38.      */
  39.     private $customer;
  40.     /**
  41.      * @ORM\Column(type="boolean")
  42.      */
  43.     private $defaultAddress false;
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getApartmentNumber()
  49.     {
  50.         return $this->apartmentNumber;
  51.     }
  52.     public function getCity()
  53.     {
  54.         return $this->city;
  55.     }
  56.     public function getPropertyNumber()
  57.     {
  58.         return $this->propertyNumber;
  59.     }
  60.     public function getStreet()
  61.     {
  62.         return $this->street;
  63.     }
  64.     public function getZipCode()
  65.     {
  66.         return $this->zipCode;
  67.     }
  68.     public function setApartmentNumber($apartmentNumber)
  69.     {
  70.         $this->apartmentNumber $apartmentNumber;
  71.     }
  72.     public function setCity($city)
  73.     {
  74.         $this->city $city;
  75.     }
  76.     public function setPropertyNumber($propertyNumber)
  77.     {
  78.         $this->propertyNumber $propertyNumber;
  79.     }
  80.     public function setStreet($street)
  81.     {
  82.         $this->street $street;
  83.     }
  84.     public function setZipCode($zipCode)
  85.     {
  86.         $this->zipCode $zipCode;
  87.     }
  88.     public function getCustomer(): Customer
  89.     {
  90.         return $this->customer;
  91.     }
  92.     public function setCustomer(Customer $customer): self
  93.     {
  94.         $this->customer $customer;
  95.         return $this;
  96.     }
  97.     public function isDefaultAddress()
  98.     {
  99.         return $this->defaultAddress;
  100.     }
  101.     public function setDefaultAddress($defaultAddress)
  102.     {
  103.         $this->defaultAddress $defaultAddress;
  104.     }
  105.     public function __toString()
  106.     {
  107.         $address $this->zipCode ' ' $this->city ', ' $this->street ' ' $this->propertyNumber;
  108.         $address .= ($this->apartmentNumber != '') ? '/' $this->apartmentNumber '';
  109.         return $address;
  110.     }
  111. }