<?php
namespace App\Entity\Master;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="eposm_m_address")
* @ORM\Entity
*/
class Address
{
public function __toString()
{
return $this->name.' - '.$this->getDisplayAddress();
}
public function getDisplayAddress()
{
$result = $this->street.' '.$this->number;
if($this->internal != null) $result.= ' Int. '.$this->internal;
if($this->stairs != null) $result.= ' '.$this->stairs;
if($this->floor != null) $result.= ' '.$this->floor;
if($this->zip != null) $result.= ' - '.$this->zip;
if($this->city != null) $result.= ' - '.$this->city;
return $result;
}
/**
* @ORM\Column(name="id", type="bigint")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(name="name", type="string", length=191)
*/
protected $name;
/**
* @ORM\Column(name="street", type="string", length=191)
*/
protected $street;
/**
* @ORM\Column(name="number", type="string", length=191)
*/
protected $number;
/**
* @ORM\Column(name="internal", type="string", length=191, nullable=true)
*/
protected $internal;
/**
* @ORM\Column(name="stairs", type="string", length=191, nullable=true)
*/
protected $stairs;
/**
* @ORM\Column(name="floor", type="string", length=191, nullable=true)
*/
protected $floor;
/**
* @ORM\Column(name="zip", type="string", length=191, nullable=true)
*/
protected $zip;
/**
* @ORM\Column(name="main", type="boolean")
*/
protected $main = false;
// ManyToOne
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Master\City", inversedBy="addresses")
* @ORM\JoinColumn(name="city_id", referencedColumnName="id")
*/
private $city;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Master\Company", inversedBy="addresses")
* @ORM\JoinColumn(name="company_id", referencedColumnName="id")
*/
private $company;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Master\Supplier", inversedBy="addresses")
* @ORM\JoinColumn(name="supplier_id", referencedColumnName="id")
*/
private $supplier;
//
public function getId(): ?string
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getStreet(): ?string
{
return $this->street;
}
public function setStreet(string $street): self
{
$this->street = $street;
return $this;
}
public function getNumber(): ?string
{
return $this->number;
}
public function setNumber(string $number): self
{
$this->number = $number;
return $this;
}
public function getInternal(): ?string
{
return $this->internal;
}
public function setInternal(?string $internal): self
{
$this->internal = $internal;
return $this;
}
public function getStairs(): ?string
{
return $this->stairs;
}
public function setStairs(?string $stairs): self
{
$this->stairs = $stairs;
return $this;
}
public function getFloor(): ?string
{
return $this->floor;
}
public function setFloor(?string $floor): self
{
$this->floor = $floor;
return $this;
}
public function getZip(): ?string
{
return $this->zip;
}
public function setZip(?string $zip): self
{
$this->zip = $zip;
return $this;
}
public function isMain(): ?bool
{
return $this->main;
}
public function setMain(bool $main): self
{
$this->main = $main;
return $this;
}
public function getCity(): ?City
{
return $this->city;
}
public function setCity(?City $city): self
{
$this->city = $city;
return $this;
}
public function getCompany(): ?Company
{
return $this->company;
}
public function setCompany(?Company $company): self
{
$this->company = $company;
return $this;
}
public function getSupplier(): ?Supplier
{
return $this->supplier;
}
public function setSupplier(?Supplier $supplier): self
{
$this->supplier = $supplier;
return $this;
}
}