Пример #1
0
 /**
  * Create a new PoiType 
  * @param String $objPoiType: a json object containing info of PoiType                  
  */
 public static function addNewPoiType($objPoiType)
 {
     $response = array();
     try {
         $poiType = SharcPoiType::create(array('id' => $objPoiType['id'], 'name' => $objPoiType['name'], 'description' => $objPoiType['description'], 'designerId' => $objPoiType['designerId']));
         $result = $poiType->save();
         if ($result) {
             //= 1 success
             $response["status"] = SUCCESS;
             $response["data"] = $poiType->toArray();
         } else {
             //error
             $response["status"] = ERROR;
             $response["data"] = INTERNAL_SERVER_ERROR;
         }
         //update other table e.g. route/event/media
     } catch (Exception $e) {
         $response["status"] = ERROR;
         $response["data"] = Utils::getExceptionMessage($e);
     }
     return $response;
 }