From 6da49bb38b83403bf1a7f6e040ca476c6a4169f3 Mon Sep 17 00:00:00 2001 From: rtorralba Date: Thu, 23 Apr 2015 17:04:57 +0200 Subject: [PATCH 1/2] fixed $this->table attribute access --- snippets/codeigniter.snippets | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/snippets/codeigniter.snippets b/snippets/codeigniter.snippets index 0fabcc5..798805e 100644 --- a/snippets/codeigniter.snippets +++ b/snippets/codeigniter.snippets @@ -44,17 +44,17 @@ snippet ci_model_complet public function getRows() { - return $this->db->get($table)->result(); + return $this->db->get($this->table)->result(); } public function getRow($id) { - return $this->db->get_where($table, array('id', $id))->result(); + return $this->db->get_where($this->table, array('id', $id))->result(); } public function insert($data) { - if($this->db->insert($table, $data)) + if($this->db->insert($this->table, $data)) return true; else return false; @@ -62,7 +62,7 @@ snippet ci_model_complet public function update($id, $data) { - if($this->db->where('id', $id)->update($table, $data)) + if($this->db->where('id', $id)->update($this->table, $data)) return true; else return false; From 3ca0742a2a1ef105797b150935a02dc2a05dc3ff Mon Sep 17 00:00:00 2001 From: rtorralba Date: Thu, 23 Apr 2015 17:11:59 +0200 Subject: [PATCH 2/2] removed comments --- snippets/codeigniter.snippets | 47 ----------------------------------- 1 file changed, 47 deletions(-) diff --git a/snippets/codeigniter.snippets b/snippets/codeigniter.snippets index 1564d4e..efd7620 100644 --- a/snippets/codeigniter.snippets +++ b/snippets/codeigniter.snippets @@ -42,14 +42,6 @@ snippet ci_model_crudl ${3:// code...} } - // public create(data) {{{ - /** - * create - * - * @param mixed $data - * @access public - * @return boolean - */ public function create($data) { if($this->db->insert($table, $data)) @@ -57,31 +49,12 @@ snippet ci_model_crudl else return false; } - // }}} - // public read(id) {{{ - /** - * read - * - * @param int $id - * @access public - * @return boolean - */ public function read($id) { return $this->db->get_where($this->table, array('id', $id))->result(); } - // }}} - // public update(id,data) {{{ - /** - * update - * - * @param int $id - * @param mixed $data - * @access public - * @return boolean - */ public function update($id, $data) { if($this->db->update($table, $data, array('id' => $id))) @@ -89,16 +62,7 @@ snippet ci_model_crudl else return false; } - // }}} - // public delete(id) {{{ - /** - * delete - * - * @param mixed $id (int o array of int) - * @access public - * @return boolean - */ public function delete($id) { if(is_array($id)) @@ -116,24 +80,13 @@ snippet ci_model_crudl return false; } } - // }}} - // public listRows(limit=null,offset=0) {{{ - /** - * listRows - * - * @param int $limit - * @param int $offset - * @access public - * @return boolean - */ public function listRows($limit = null, $offset = 0) { if(!is_null($limit)) $this->db->limit($limit, $offset); return $this->db->get($table)->result(); } - // }}} } # Load view snippet ci_load-view