<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use App\BackendBundle\Interfaces\LocationInterface;
use JsonSerializable;
class CompanyLocation implements LocationInterface, JsonSerializable {
/**
* @var integer
*/
private $id;
/**
* @var string
*/
private $name;
/**
* @var string
*/
private $wknr;
/**
* @var string
*/
private $bnr;
/**
* @var integer
*/
private $position;
/**
* @var boolean
*/
private $isActive = true;
/**
* @var \DateTime
*/
private $createdAt;
/**
* @var \App\Entity\Address
*/
private $address;
/**
* @var \App\Entity\CompanyProfile
*/
private $companyProfile;
/**
* Get id
*
* @return integer
*/
public function getId() {
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return CompanyLocation
*/
public function setName($name) {
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName() {
return $this->name;
}
/**
* Set wknr
*
* @param string $wknr
*
* @return CompanyLocation
*/
public function setWknr($wknr) {
$this->wknr = $wknr;
return $this;
}
/**
* Get wknr
*
* @return string
*/
public function getWknr() {
return $this->wknr;
}
/**
* Set bnr
*
* @param string $bnr
*
* @return CompanyLocation
*/
public function setBnr($bnr) {
$this->bnr = $bnr;
return $this;
}
/**
* Get bnr
*
* @return string
*/
public function getBnr() {
return $this->bnr;
}
/**
* Set position
*
* @param integer $position
*
* @return CompanyLocation
*/
public function setPosition($position) {
$this->position = $position;
return $this;
}
/**
* Get position
*
* @return integer
*/
public function getPosition() {
return $this->position;
}
/**
* Set isActive
*
* @param boolean $isActive
*
* @return CompanyLocation
*/
public function setIsActive($isActive) {
$this->isActive = $isActive;
return $this;
}
/**
* Get isActive
*
* @return boolean
*/
public function getIsActive() {
return $this->isActive;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return CompanyLocation
*/
public function setCreatedAt($createdAt) {
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public function getCreatedAt() {
return $this->createdAt;
}
/**
* Set address
*
* @param \App\Entity\Address $address
*
* @return CompanyLocation
*/
public function setAddress(\App\Entity\Address $address = null) {
$this->address = $address;
return $this;
}
/**
* Get address
*
* @return \App\Entity\Address
*/
public function getAddress() {
return $this->address;
}
/**
* Set companyProfile
*
* @param \App\Entity\CompanyProfile $companyProfile
*
* @return CompanyLocation
*/
public function setCompanyProfile(\App\Entity\CompanyProfile $companyProfile = null) {
$this->companyProfile = $companyProfile;
return $this;
}
/**
* Get companyProfile
*
* @return \App\Entity\CompanyProfile
*/
public function getCompanyProfile() {
return $this->companyProfile;
}
public function getCityID() {
if (is_null($this->address)) {
return '';
}
return $this->address->getCityID();
}
public function getCityName() {
if (is_null($this->address)) {
return '';
}
return $this->address->getCityName();
}
public function getDistrictID() {
if (is_null($this->address)) {
return '';
}
return $this->address->getDistrictID();
}
public function getDistrictName() {
if (is_null($this->address)) {
return '';
}
return $this->address->getDistrictName();
}
public function getGeoData() {
if (empty($this->address)) {
return null;
}
return $this->address->getGeoData();
}
public function jsonSerialize(): mixed {
$data = array();
$data['id'] = $this->id;
$data['name'] = $this->name;
$data['bnr'] = $this->bnr;
$data['streetNumber'] = $this->address->getStreetNumber();
$data['zip'] = $this->address->getCityZip();
$data['city'] = $this->address->getCityName();
$data['lat'] = $this->address->getLat();
$data['lon'] = $this->address->getLon();
return json_encode($data);
}
}