Esempio n. 1
0
 /**
  * @param string $tableName
  * @param null|integer $id
  * @return bool|null|\stdClass|\stdClass[]
  */
 public function get($tableName, $id = null)
 {
     if ($id === null) {
         $this->db->setQuery('SELECT * FROM ' . $tableName . ';');
         $this->db->query();
         if ($this->db->getSqlstate() === '00000') {
             return $this->db->loadObjectList();
         } else {
             return false;
         }
     } else {
         $this->db->setQuery('SELECT * FROM ' . $tableName . ' WHERE id = ' . $this->sanitize($id) . ';');
         $this->db->query();
         if ($this->db->getSqlstate() === '00000') {
             return $this->db->loadObject();
         } else {
             return false;
         }
     }
 }