예제 #1
0
 public function getCityRegion()
 {
     if (is_null($this->city_region) && is_numeric($this->city_region_id)) {
         $d = new Location_Domain_CityRegion();
         $this->city_region = $d->getById($this->city_region_id);
     }
     if (is_null($this->city_region)) {
         $this->city_region = new Location_Model_CityRegion();
     }
     return $this->city_region;
 }
예제 #2
0
 public function populate($data)
 {
     if (isset($data['id'])) {
         $this->_region->setId($data['id']);
     }
     $this->_region->setName($data['name']);
     if (isset($data['city_id'])) {
         $dc = new Location_Domain_City();
         $c = $dc->getById($data['city_id']);
         $this->_region->setCity($c);
         $this->_region->setCity_id($data['city_id']);
     }
     if (isset($data['parent_id'])) {
         if (is_numeric($data['parent_id'])) {
             $dc = new Location_Domain_CityRegion();
             $c = $dc->getById($data['parent_id']);
             $this->_region->setParent($c);
             $this->_region->setParent_id($data['parent_id']);
         }
     }
 }