src/Entity/Master/Address.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Master;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table(name="eposm_m_address")
  9.  * @ORM\Entity
  10.  */
  11. class Address
  12. {    
  13.     public function __toString()
  14.     {
  15.         return $this->name.' - '.$this->getDisplayAddress();
  16.     }
  17.     public function getDisplayAddress()
  18.     {
  19.         $result $this->street.' '.$this->number;
  20.         if($this->internal != null$result.= ' Int. '.$this->internal;
  21.         if($this->stairs != null$result.= ' '.$this->stairs;
  22.         if($this->floor != null$result.= ' '.$this->floor;
  23.         if($this->zip != null$result.= ' - '.$this->zip;
  24.         if($this->city != null$result.= ' - '.$this->city;
  25.         return $result;
  26.     }
  27.     
  28.     /**
  29.      * @ORM\Column(name="id", type="bigint")
  30.      * @ORM\Id
  31.      * @ORM\GeneratedValue(strategy="AUTO")
  32.      */
  33.     protected $id;
  34.     
  35.     /**
  36.      * @ORM\Column(name="name", type="string", length=191)
  37.      */
  38.     protected $name;
  39.     
  40.     /**
  41.      * @ORM\Column(name="street", type="string", length=191)
  42.      */
  43.     protected $street;
  44.     /**
  45.      * @ORM\Column(name="number", type="string", length=191)
  46.      */
  47.     protected $number;
  48.     /**
  49.      * @ORM\Column(name="internal", type="string", length=191, nullable=true)
  50.      */
  51.     protected $internal;
  52.     /**
  53.      * @ORM\Column(name="stairs", type="string", length=191, nullable=true)
  54.      */
  55.     protected $stairs;
  56.     /**
  57.      * @ORM\Column(name="floor", type="string", length=191, nullable=true)
  58.      */
  59.     protected $floor;
  60.     /**
  61.      * @ORM\Column(name="zip", type="string", length=191, nullable=true)
  62.      */
  63.     protected $zip;
  64.     /**
  65.      * @ORM\Column(name="main", type="boolean")
  66.      */
  67.     protected $main false;
  68.     // ManyToOne
  69.         /**
  70.          * @ORM\ManyToOne(targetEntity="App\Entity\Master\City", inversedBy="addresses")
  71.          * @ORM\JoinColumn(name="city_id", referencedColumnName="id")
  72.          */
  73.         private $city;
  74.         
  75.         /**
  76.          * @ORM\ManyToOne(targetEntity="App\Entity\Master\Company", inversedBy="addresses")
  77.          * @ORM\JoinColumn(name="company_id", referencedColumnName="id")
  78.          */
  79.         private $company;
  80.         
  81.         /**
  82.          * @ORM\ManyToOne(targetEntity="App\Entity\Master\Supplier", inversedBy="addresses")
  83.          * @ORM\JoinColumn(name="supplier_id", referencedColumnName="id")
  84.          */
  85.         private $supplier;
  86.     //
  87.     public function getId(): ?string
  88.     {
  89.         return $this->id;
  90.     }
  91.     public function getName(): ?string
  92.     {
  93.         return $this->name;
  94.     }
  95.     public function setName(string $name): self
  96.     {
  97.         $this->name $name;
  98.         return $this;
  99.     }
  100.     public function getStreet(): ?string
  101.     {
  102.         return $this->street;
  103.     }
  104.     public function setStreet(string $street): self
  105.     {
  106.         $this->street $street;
  107.         return $this;
  108.     }
  109.     public function getNumber(): ?string
  110.     {
  111.         return $this->number;
  112.     }
  113.     public function setNumber(string $number): self
  114.     {
  115.         $this->number $number;
  116.         return $this;
  117.     }
  118.     public function getInternal(): ?string
  119.     {
  120.         return $this->internal;
  121.     }
  122.     public function setInternal(?string $internal): self
  123.     {
  124.         $this->internal $internal;
  125.         return $this;
  126.     }
  127.     public function getStairs(): ?string
  128.     {
  129.         return $this->stairs;
  130.     }
  131.     public function setStairs(?string $stairs): self
  132.     {
  133.         $this->stairs $stairs;
  134.         return $this;
  135.     }
  136.     public function getFloor(): ?string
  137.     {
  138.         return $this->floor;
  139.     }
  140.     public function setFloor(?string $floor): self
  141.     {
  142.         $this->floor $floor;
  143.         return $this;
  144.     }
  145.     public function getZip(): ?string
  146.     {
  147.         return $this->zip;
  148.     }
  149.     public function setZip(?string $zip): self
  150.     {
  151.         $this->zip $zip;
  152.         return $this;
  153.     }
  154.     public function isMain(): ?bool
  155.     {
  156.         return $this->main;
  157.     }
  158.     public function setMain(bool $main): self
  159.     {
  160.         $this->main $main;
  161.         return $this;
  162.     }
  163.     public function getCity(): ?City
  164.     {
  165.         return $this->city;
  166.     }
  167.     public function setCity(?City $city): self
  168.     {
  169.         $this->city $city;
  170.         return $this;
  171.     }
  172.     public function getCompany(): ?Company
  173.     {
  174.         return $this->company;
  175.     }
  176.     public function setCompany(?Company $company): self
  177.     {
  178.         $this->company $company;
  179.         return $this;
  180.     }
  181.     public function getSupplier(): ?Supplier
  182.     {
  183.         return $this->supplier;
  184.     }
  185.     public function setSupplier(?Supplier $supplier): self
  186.     {
  187.         $this->supplier $supplier;
  188.         return $this;
  189.     }
  190. }