<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
class Address {
/**
* @var integer
*/
private $id;
/**
* @var string
*/
private $street;
/**
* @var string
*/
private $number;
/**
* @var string
*/
private $floor;
/**
* @var string
*/
private $stair;
/**
* @var \App\Entity\AddressLatLon
*/
private $addressLatLon;
/**
* @var \App\Entity\AddressType
*/
private $addressType;
/**
* @var \App\Entity\AddressCity
*/
private $addressCity;
/**
* Get id
*
* @return integer
*/
public function getId() {
return $this->id;
}
/**
* Set street
*
* @param string $street
*
* @return Address
*/
public function setStreet($street) {
$this->street = $street;
return $this;
}
/**
* Get street
*
* @return string
*/
public function getStreet() {
return $this->street;
}
/**
* Set number
*
* @param string $number
*
* @return Address
*/
public function setNumber($number) {
$this->number = $number;
return $this;
}
/**
* Get number
*
* @return string
*/
public function getNumber() {
return $this->number;
}
/**
* Set floor
*
* @param string $floor
*
* @return Address
*/
public function setFloor($floor) {
$this->floor = $floor;
return $this;
}
/**
* Get floor
*
* @return string
*/
public function getFloor() {
return $this->floor;
}
/**
* Set stair
*
* @param string $stair
*
* @return Address
*/
public function setStair($stair) {
$this->stair = $stair;
return $this;
}
/**
* Get stair
*
* @return string
*/
public function getStair() {
return $this->stair;
}
/**
* Set addressLatLon
*
* @param \App\Entity\AddressLatLon $addressLatLon
*
* @return Address
*/
public function setAddressLatLon(\App\Entity\AddressLatLon $addressLatLon = null) {
$this->addressLatLon = $addressLatLon;
return $this;
}
/**
* Get addressLatLon
*
* @return \App\Entity\AddressLatLon
*/
public function getAddressLatLon() {
return $this->addressLatLon;
}
/**
* Set addressType
*
* @param \App\Entity\AddressType $addressType
*
* @return Address
*/
public function setAddressType(\App\Entity\AddressType $addressType = null) {
$this->addressType = $addressType;
return $this;
}
/**
* Get addressType
*
* @return \App\Entity\AddressType
*/
public function getAddressType() {
return $this->addressType;
}
/**
* Set addressCity
*
* @param \App\Entity\AddressCity $addressCity
*
* @return Address
*/
public function setAddressCity(\App\Entity\AddressCity $addressCity = null) {
$this->addressCity = $addressCity;
return $this;
}
/**
* Get addressCity
*
* @return \App\Entity\AddressCity
*/
public function getAddressCity() {
return $this->addressCity;
}
public function getStringFull() {
return $this->getStreetNumber() . ', ' . $this->getCityName();
}
public function getStringLimit() {
$limit = 30;
$full = $this->getStringFull();
if (mb_strlen($full) > $limit) {
$strReduced = mb_substr($full, 0, $limit);
return "$strReduced...";
}
return $full;
}
/**
* Get street full
*
* @return string
*/
public function getStreetNumber() {
return $this->street . ' ' . $this->number;
}
/**
* Get city id
*
* @return string
*/
public function getCityID() {
if (!is_null($this->addressCity)) {
return $this->addressCity->getId();
}
return '';
}
/**
* Get city name
*
* @return string
*/
public function getCityName() {
if (!is_null($this->addressCity)) {
return $this->addressCity->getName();
}
return '';
}
/**
* Get city zip
*
* @return string
*/
public function getCityZip() {
if (!is_null($this->addressCity)) {
return $this->addressCity->getZip();
}
return '';
}
/**
* Get city full
*
* @return string
*/
public function getCityFull() {
if (!is_null($this->addressCity)) {
return $this->addressCity->getCityFull();
}
return '';
}
/**
* Get district id
*
* @return string
*/
public function getDistrictID() {
if (!is_null($this->addressCity)) {
return $this->addressCity->getDistrictID();
}
return '';
}
/**
* Get district name
*
* @return string
*/
public function getDistrictName() {
if (!is_null($this->addressCity)) {
return $this->addressCity->getDistrictName();
}
return '';
}
/**
* Get country code
*
* @return string
*/
public function getCountryCode() {
if (!is_null($this->addressCity)) {
return $this->addressCity->getCountryCode();
}
return '';
}
/**
* Get country
*
* @return string
*/
public function getCountry() {
if (!is_null($this->addressCity)) {
return $this->addressCity->getCountry();
}
return '';
}
/**
* Get Latitude
*
* @return string
*/
public function getLat() {
if (is_null($this->addressLatLon)) {
return '';
}
return $this->addressLatLon->getLat();
}
/**
* Get Longitude
*
* @return string
*/
public function getLon() {
if (is_null($this->addressLatLon)) {
return '';
}
return $this->addressLatLon->getLon();
}
/**
* Get json text
*
* @return string
*/
public function getJsonCityText() {
$data = array();
if (!empty($this->addressCity)) {
$data['id'] = $this->addressCity->getId();
$data['text'] = $this->addressCity->getFullName();
}
return json_encode($data);
}
public function getFullAddress() {
$strAddress = "";
$strAddress .= $this->getStreetNumber() . ', ';
$strAddress .= $this->getCityZip() . " ";
$strAddress .= $this->getCityName();
return $strAddress;
}
public function getGeoData() {
if (empty($this->addressLatLon)) {
return null;
}
$data = array();
$data['lat'] = $this->addressLatLon->getLat();
$data['lon'] = $this->addressLatLon->getLon();
return $data;
}
public function __toString() {
return $this->getStringFull();
}
}