public static function loadById($id) { $mysql = CL_MySQL::getInstance(); $mysql->select('user', '*', ['id' => $id]); $o = $mysql->fetchObject(); if ($o === NULL) { return NULL; } return new UserModel($o); }
function __construct() { parent::CL_Controller(); $this->load->model('ModelModel'); $this->load->model('ScenarioModel'); $this->load->model('ContextModel'); $this->load->model('QueryModel'); $this->load->model('TempModel'); $this->db = CL_MySQL::getInstance(); }
public static function loadByUser($userId) { $db = CL_MySQL::getInstance(); $db->select('study', '*', ['study_to_user' => ['studyId' => 'id']], ['study_to_user.userId' => $userId]); // echo $db->getQuery(); // exit(); $studies = []; while ($o = $db->fetchObject()) { $studies[] = self::fromObject($o); } return $studies; }
function __construct() { parent::CL_Controller(); $this->load->model('CaseModel'); $this->load->model('ModelModel'); $this->load->model('ScenarioModel'); $this->load->model('QueryModel'); $this->load->model('ContextModel'); $this->db = CL_MySQL::getInstance(); if (!$this->session->is_set('caseId')) { $this->location('/'); } }
function log($url, $id) { $mysql = CL_MySQL::getInstance(); $mysql->insert('blog', ['url' => $url, 'id' => $id]); }
/** * Shortcut for instantiating mysql. * * @return CL_MySQL */ function cl_mysql() { return CL_MySQL::getInstance(); }
public static function remove($id, $caseId) { $db = CL_MySQL::getInstance(); $db->query("DELETE FROM `temp` WHERE `id` = '{$id}' AND `caseId` = {$caseId}"); }