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.         public function getId(): ?string
  87.         {
  88.             return $this->id;
  89.         }
  90.         public function getName(): ?string
  91.         {
  92.             return $this->name;
  93.         }
  94.         public function setName(string $name): static
  95.         {
  96.             $this->name $name;
  97.             return $this;
  98.         }
  99.         public function getStreet(): ?string
  100.         {
  101.             return $this->street;
  102.         }
  103.         public function setStreet(string $street): static
  104.         {
  105.             $this->street $street;
  106.             return $this;
  107.         }
  108.         public function getNumber(): ?string
  109.         {
  110.             return $this->number;
  111.         }
  112.         public function setNumber(string $number): static
  113.         {
  114.             $this->number $number;
  115.             return $this;
  116.         }
  117.         public function getInternal(): ?string
  118.         {
  119.             return $this->internal;
  120.         }
  121.         public function setInternal(?string $internal): static
  122.         {
  123.             $this->internal $internal;
  124.             return $this;
  125.         }
  126.         public function getStairs(): ?string
  127.         {
  128.             return $this->stairs;
  129.         }
  130.         public function setStairs(?string $stairs): static
  131.         {
  132.             $this->stairs $stairs;
  133.             return $this;
  134.         }
  135.         public function getFloor(): ?string
  136.         {
  137.             return $this->floor;
  138.         }
  139.         public function setFloor(?string $floor): static
  140.         {
  141.             $this->floor $floor;
  142.             return $this;
  143.         }
  144.         public function getZip(): ?string
  145.         {
  146.             return $this->zip;
  147.         }
  148.         public function setZip(?string $zip): static
  149.         {
  150.             $this->zip $zip;
  151.             return $this;
  152.         }
  153.         public function isMain(): ?bool
  154.         {
  155.             return $this->main;
  156.         }
  157.         public function setMain(bool $main): static
  158.         {
  159.             $this->main $main;
  160.             return $this;
  161.         }
  162.         public function getCity(): ?City
  163.         {
  164.             return $this->city;
  165.         }
  166.         public function setCity(?City $city): static
  167.         {
  168.             $this->city $city;
  169.             return $this;
  170.         }
  171.         public function getCompany(): ?Company
  172.         {
  173.             return $this->company;
  174.         }
  175.         public function setCompany(?Company $company): static
  176.         {
  177.             $this->company $company;
  178.             return $this;
  179.         }
  180.         public function getSupplier(): ?Supplier
  181.         {
  182.             return $this->supplier;
  183.         }
  184.         public function setSupplier(?Supplier $supplier): static
  185.         {
  186.             $this->supplier $supplier;
  187.             return $this;
  188.         }
  189. }