src/Entity/SchoolLocation.php line 9

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\BackendBundle\Interfaces\LocationInterface;
  5. use JsonSerializable;
  6. class SchoolLocation implements LocationInterfaceJsonSerializable {
  7.     /**
  8.      * @var integer
  9.      */
  10.     private $id;
  11.     /**
  12.      * @var string
  13.      */
  14.     private $name;
  15.     /**
  16.      * @var integer
  17.      */
  18.     private $position;
  19.     /**
  20.      * @var boolean
  21.      */
  22.     private $isActive true;
  23.     /**
  24.      * @var \DateTime
  25.      */
  26.     private $createdAt;
  27.     /**
  28.      * @var \App\Entity\Address
  29.      */
  30.     private $address;
  31.     /**
  32.      * @var \App\Entity\SchoolProfile
  33.      */
  34.     private $schoolProfile;
  35.     /**
  36.      * Get id
  37.      *
  38.      * @return integer
  39.      */
  40.     public function getId() {
  41.         return $this->id;
  42.     }
  43.     /**
  44.      * Set name
  45.      *
  46.      * @param string $name
  47.      *
  48.      * @return SchoolLocation
  49.      */
  50.     public function setName($name) {
  51.         $this->name $name;
  52.         return $this;
  53.     }
  54.     /**
  55.      * Get name
  56.      *
  57.      * @return string
  58.      */
  59.     public function getName() {
  60.         return $this->name;
  61.     }
  62.     /**
  63.      * Set position
  64.      *
  65.      * @param integer $position
  66.      *
  67.      * @return SchoolLocation
  68.      */
  69.     public function setPosition($position) {
  70.         $this->position $position;
  71.         return $this;
  72.     }
  73.     /**
  74.      * Get position
  75.      *
  76.      * @return integer
  77.      */
  78.     public function getPosition() {
  79.         return $this->position;
  80.     }
  81.     /**
  82.      * Set isActive
  83.      *
  84.      * @param boolean $isActive
  85.      *
  86.      * @return SchoolLocation
  87.      */
  88.     public function setIsActive($isActive) {
  89.         $this->isActive $isActive;
  90.         return $this;
  91.     }
  92.     /**
  93.      * Get isActive
  94.      *
  95.      * @return boolean
  96.      */
  97.     public function getIsActive() {
  98.         return $this->isActive;
  99.     }
  100.     /**
  101.      * Set createdAt
  102.      *
  103.      * @param \DateTime $createdAt
  104.      *
  105.      * @return SchoolLocation
  106.      */
  107.     public function setCreatedAt($createdAt) {
  108.         $this->createdAt $createdAt;
  109.         return $this;
  110.     }
  111.     /**
  112.      * Get createdAt
  113.      *
  114.      * @return \DateTime
  115.      */
  116.     public function getCreatedAt() {
  117.         return $this->createdAt;
  118.     }
  119.     /**
  120.      * Set address
  121.      *
  122.      * @param \App\Entity\Address $address
  123.      *
  124.      * @return SchoolLocation
  125.      */
  126.     public function setAddress(\App\Entity\Address $address null) {
  127.         $this->address $address;
  128.         return $this;
  129.     }
  130.     /**
  131.      * Get address
  132.      *
  133.      * @return \App\Entity\Address
  134.      */
  135.     public function getAddress() {
  136.         return $this->address;
  137.     }
  138.     /**
  139.      * Set schoolProfile
  140.      *
  141.      * @param \App\Entity\SchoolProfile $schoolProfile
  142.      *
  143.      * @return SchoolLocation
  144.      */
  145.     public function setSchoolProfile(\App\Entity\SchoolProfile $schoolProfile null) {
  146.         $this->schoolProfile $schoolProfile;
  147.         return $this;
  148.     }
  149.     /**
  150.      * Get schoolProfile
  151.      *
  152.      * @return \App\Entity\SchoolProfile
  153.      */
  154.     public function getSchoolProfile() {
  155.         return $this->schoolProfile;
  156.     }
  157.     public function getCityID() {
  158.         if (is_null($this->address)) {
  159.             return '';
  160.         }
  161.         return $this->address->getCityID();
  162.     }
  163.     public function getCityName() {
  164.         if (is_null($this->address)) {
  165.             return '';
  166.         }
  167.         return $this->address->getCityName();
  168.     }
  169.     public function getDistrictID() {
  170.         if (is_null($this->address)) {
  171.             return '';
  172.         }
  173.         return $this->address->getDistrictID();
  174.     }
  175.     public function getDistrictName() {
  176.         if (is_null($this->address)) {
  177.             return '';
  178.         }
  179.         return $this->address->getDistrictName();
  180.     }
  181.     public function getGeoData() {
  182.         if (empty($this->address)) {
  183.             return null;
  184.         }
  185.         return $this->address->getGeoData();
  186.     }
  187.     public function jsonSerialize(): mixed {
  188.         $data = array();
  189.         $data['id'] = $this->id;
  190.         $data['name'] = $this->name;
  191.         $data['streetNumber'] = $this->address->getStreetNumber();
  192.         $data['zip'] = $this->address->getCityZip();
  193.         $data['city'] = $this->address->getCityName();
  194.         $data['lat'] = $this->address->getLat();
  195.         $data['lon'] = $this->address->getLon();
  196.         return json_encode($data);
  197.     }
  198. }