<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use App\BackendBundle\Interfaces\LocationInterface;
use JsonSerializable;
class SchoolLocation implements LocationInterface, JsonSerializable {
/**
* @var integer
*/
private $id;
/**
* @var string
*/
private $name;
/**
* @var integer
*/
private $position;
/**
* @var boolean
*/
private $isActive = true;
/**
* @var \DateTime
*/
private $createdAt;
/**
* @var \App\Entity\Address
*/
private $address;
/**
* @var \App\Entity\SchoolProfile
*/
private $schoolProfile;
/**
* Get id
*
* @return integer
*/
public function getId() {
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return SchoolLocation
*/
public function setName($name) {
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName() {
return $this->name;
}
/**
* Set position
*
* @param integer $position
*
* @return SchoolLocation
*/
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 SchoolLocation
*/
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 SchoolLocation
*/
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 SchoolLocation
*/
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 schoolProfile
*
* @param \App\Entity\SchoolProfile $schoolProfile
*
* @return SchoolLocation
*/
public function setSchoolProfile(\App\Entity\SchoolProfile $schoolProfile = null) {
$this->schoolProfile = $schoolProfile;
return $this;
}
/**
* Get schoolProfile
*
* @return \App\Entity\SchoolProfile
*/
public function getSchoolProfile() {
return $this->schoolProfile;
}
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['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);
}
}