Example #1
0
 public function load_details($id)
 {
     try {
         $dbObj = DB::select_array($this->fields)->from($this->TABLE)->where('ID', $id);
         //$dbResult = $dbObj->compile();
         $dbResult = $dbObj->execute();
         if (count($dbResult) > 0) {
             // Map object
             $this->isValid = true;
             $this->map($this, $dbResult->as_array()[0]);
         } else {
             $this->isValid = false;
         }
         $dbObj = DB::select('TypeName')->from('StoryType')->where('ID', $this->Type);
         $dbResult = $dbObj->execute();
         $this->TypeName = $dbResult->as_array()[0]['TypeName'];
     } catch (\Exception $e) {
         CError::dbLog($e);
         $this->isValid = false;
         return null;
     }
 }
Example #2
0
 public function delete($id)
 {
     try {
         $dbObj = DB::delete($this->TABLE)->where('ID', $id);
         $dbResult = $dbObj->execute();
     } catch (\Exception $e) {
         CError::dbLog($e);
         return null;
     }
 }
Example #3
0
 public function getIdBaseSubId($subID)
 {
     try {
         $dbObj = DB::select('ID')->from($this->STORY_TYPE_TABLE)->where('SubID', $subID);
         $dbResult = $dbObj->execute();
         return $dbResult->as_array()[0]['ID'];
     } catch (\Exception $e) {
         CError::dbLog($e);
         return null;
     }
 }
Example #4
0
 private function buildListBaseSection($sectionCode)
 {
     try {
         $dbObj = DB::select('ID')->from($this->TABLE)->where('Type', $sectionCode)->order_by('DateCreate', 'dsc');
         $dbResult = $dbObj->execute();
         if (($this->length = count($dbResult)) == 0) {
             return null;
         }
         return $dbResult->as_array();
     } catch (\Exception $e) {
         CError::dbLog($e);
         return null;
     }
 }