src/Entity/CustomerInvoiceAddress.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\CustomerInvoiceAddressRepository")
  8.  */
  9. class CustomerInvoiceAddress
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", length=255, nullable=false)
  19.      */
  20.     private $name;
  21.     /**
  22.      * @ORM\Column(type="bigint")
  23.      */
  24.     private $nip;
  25.     /**
  26.      * @ORM\Column(type="string", length=255, nullable=true)
  27.      */
  28.     private $zipCode;
  29.     /**
  30.      * @ORM\Column(type="string", length=255, nullable=true)
  31.      */
  32.     private $city;
  33.     /**
  34.      * @ORM\Column(type="string", length=255, nullable=true)
  35.      */
  36.     private $street;
  37.     /**
  38.      * @ORM\Column(type="string", length=255, nullable=true)
  39.      */
  40.     private $propertyNumber;
  41.     /**
  42.      * @ORM\Column(type="string", length=255, nullable=true)
  43.      */
  44.     private $apartmentNumber;
  45.     /**
  46.      * @ORM\ManyToOne(targetEntity="App\Entity\Customer", inversedBy="addresses", cascade={"remove","persist"})
  47.      * @ORM\JoinColumn(name="customer_id", referencedColumnName="id", nullable=false)
  48.      */
  49.     private $customer;
  50.     /**
  51.      * @ORM\OneToMany(targetEntity="App\Entity\Inquiry", mappedBy="recipient", orphanRemoval=true)
  52.      */
  53.     private $inquiries;
  54.     public function __construct()
  55.     {
  56.         $this->inquiries = new ArrayCollection();
  57.     }
  58.     public function getId(): ?int
  59.     {
  60.         return $this->id;
  61.     }
  62.     public function getName()
  63.     {
  64.         return $this->name;
  65.     }
  66.     public function setName($name): void
  67.     {
  68.         $this->name $name;
  69.     }
  70.     /** @return mixed */
  71.     public function getNip()
  72.     {
  73.         return $this->nip;
  74.     }
  75.     /** @param mixed $nip */
  76.     public function setNip($nip): void
  77.     {
  78.         $this->nip $nip;
  79.     }
  80.     public function getApartmentNumber()
  81.     {
  82.         return $this->apartmentNumber;
  83.     }
  84.     public function getCity()
  85.     {
  86.         return $this->city;
  87.     }
  88.     public function getPropertyNumber()
  89.     {
  90.         return $this->propertyNumber;
  91.     }
  92.     public function getStreet()
  93.     {
  94.         return $this->street;
  95.     }
  96.     public function getZipCode()
  97.     {
  98.         return $this->zipCode;
  99.     }
  100.     public function setApartmentNumber($apartmentNumber)
  101.     {
  102.         $this->apartmentNumber $apartmentNumber;
  103.     }
  104.     public function setCity($city)
  105.     {
  106.         $this->city $city;
  107.     }
  108.     public function setPropertyNumber($propertyNumber)
  109.     {
  110.         $this->propertyNumber $propertyNumber;
  111.     }
  112.     public function setStreet($street)
  113.     {
  114.         $this->street $street;
  115.     }
  116.     public function setZipCode($zipCode)
  117.     {
  118.         $this->zipCode $zipCode;
  119.     }
  120.     public function getCustomer(): Customer
  121.     {
  122.         return $this->customer;
  123.     }
  124.     public function setCustomer(Customer $customer): self
  125.     {
  126.         $this->customer $customer;
  127.         return $this;
  128.     }
  129.     /**
  130.      * @return Collection|Inquiry[]
  131.      */
  132.     public function getInquiries(): Collection
  133.     {
  134.         return $this->inquiries;
  135.     }
  136.     public function addInquiry(Inquiry $inquiry): self
  137.     {
  138.         if (!$this->inquiries->contains($inquiry)) {
  139.             $this->inquiries[] = $inquiry;
  140.             $inquiry->setInvoiceAddress($this);
  141.         }
  142.         return $this;
  143.     }
  144.     public function removeInquiry(Inquiry $inquiry): self
  145.     {
  146.         if ($this->inquiries->contains($inquiry)) {
  147.             $this->inquiries->removeElement($inquiry);
  148.             // set the owning side to null (unless already changed)
  149.             if ($inquiry->getInvoiceAddress() === $this) {
  150.                 $inquiry->setInvoiceAddress(null);
  151.             }
  152.         }
  153.         return $this;
  154.     }
  155.     public function __toString()
  156.     {
  157.         $address $this->name ', NIP:' $this->nip ', ' $this->zipCode ' ' $this->city ', ' $this->street ' ' $this->propertyNumber;
  158.         $address .= ($this->apartmentNumber != '') ? '/' $this->apartmentNumber '';
  159.         return $address;
  160.     }
  161. }