private function delete()
 {
     RealEstateAgency_Object_Settlement::deleteById($this->getGlobalData(), $this->object_id);
 }
 private function getSettlementName()
 {
     $location_id = $this->location_id;
     $location_text = $this->location_text;
     if ($location_id != NULL) {
         $object = RealEstateAgency_Object_Settlement::loadById($this->getGlobalData(), $location_id);
         return $object->getObjectName();
     } else {
         return $location_text;
     }
 }
 public function update()
 {
     $previous_object = RealEstateAgency_Object_Settlement::loadById_object($this->getGlobalData(), $this->obj_id);
     if ($previous_object) {
         $row = $previous_object->zend_row;
         $this->district_id = $row->district;
         // keep district identifier !!!
         $this->toZendRow($row);
         $row->save();
     }
 }
 private function loadData()
 {
     $globalData = $this->getGlobalData();
     $sections = $this->sections;
     $sectionsReady = $this->sectionsReady;
     if ($sectionsReady & RealEstateAgency_Const::FILTER_AREA) {
         // load name of this section;
         $object = RealEstateAgency_Object_Area::loadById($globalData, $this->area_id);
         if ($object) {
             $this->area_name = $object->getObjectName();
         }
     } else {
         // load list for selection, if necessary;
         if ($sections & RealEstateAgency_Const::FILTER_AREA) {
             $this->loadAreasList();
         }
     }
     if ($sectionsReady & RealEstateAgency_Const::FILTER_DISTRICT) {
         // load name of this section;
         $object = RealEstateAgency_Object_District::loadById($globalData, $this->district_id);
         if ($object) {
             $this->district_name = $object->getObjectName();
         }
     } else {
         // load list for selection, if necessary; and if all previous sections are ready;
         if ($sections & RealEstateAgency_Const::FILTER_DISTRICT) {
             if ($sectionsReady & RealEstateAgency_Const::FILTER_AREA) {
                 $this->loadAreasList();
                 $this->loadDistrictsList();
             }
         }
     }
     if ($sectionsReady & RealEstateAgency_Const::FILTER_SETTLEMENT) {
         // load name of this section;
         $object = RealEstateAgency_Object_Settlement::loadById($globalData, $this->settlement_id);
         if ($object) {
             $this->settlement_name = $object->getObjectName();
         }
     } else {
         // load list for selection, if necessary; and if all previous sections are ready;
         if ($sections & RealEstateAgency_Const::FILTER_SETTLEMENT) {
             if ($sectionsReady & RealEstateAgency_Const::FILTER_DISTRICT) {
                 if ($sectionsReady & RealEstateAgency_Const::FILTER_AREA) {
                     $this->loadAreasList();
                     $this->loadDistrictsList();
                     $this->loadSettlementsList();
                 }
             }
         }
     }
 }
 private function completeFillByArray($array)
 {
     $result = array();
     $globalData = $this->getGlobalData();
     $objectsOfDistrict = $this->districts;
     foreach ($array as $index => $hash) {
         $object = new RealEstateAgency_Object_Settlement();
         $object->setGlobalData($globalData);
         $object->completeFillByArray($hash);
         $result[] = $object;
     }
     return $result;
 }