@@ -50,16 +50,16 @@ |
||
| 50 | 50 | return $destination; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Turn the stadClass object to the type of calling Model |
|
| 55 | - * |
|
| 56 | - * @param String $destination |
|
| 57 | - * @param Object $sourceObject |
|
| 58 | - * @return Object $destination |
|
| 59 | - * |
|
| 60 | - * @author RN Kushwaha <[email protected]> |
|
| 61 | - * @since v0.0.5 |
|
| 62 | - */ |
|
| 53 | + /** |
|
| 54 | + * Turn the stadClass object to the type of calling Model |
|
| 55 | + * |
|
| 56 | + * @param String $destination |
|
| 57 | + * @param Object $sourceObject |
|
| 58 | + * @return Object $destination |
|
| 59 | + * |
|
| 60 | + * @author RN Kushwaha <[email protected]> |
|
| 61 | + * @since v0.0.5 |
|
| 62 | + */ |
|
| 63 | 63 | public function turnObjects($destination, $data) |
| 64 | 64 | { |
| 65 | 65 | $destination = new $destination(); |
@@ -287,8 +287,8 @@ discard block |
||
| 287 | 287 | $this->results = $stmt->fetch(\PDO::FETCH_OBJ); |
| 288 | 288 | |
| 289 | 289 | if(count($this->results) ){ |
| 290 | - // now turn this stdClass object to the object type of calling model |
|
| 291 | - $rows = $util->turnObject($this->className, $this->results); |
|
| 290 | + // now turn this stdClass object to the object type of calling model |
|
| 291 | + $rows = $util->turnObject($this->className, $this->results); |
|
| 292 | 292 | } |
| 293 | 293 | // Reset class variables |
| 294 | 294 | $this->reset(); |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | $this->results = $stmt->fetchAll(\PDO::FETCH_ASSOC); |
| 300 | 300 | if(count($this->results) ){ |
| 301 | - $rows = $util->turnObjects($this->className, $this->results); |
|
| 301 | + $rows = $util->turnObjects($this->className, $this->results); |
|
| 302 | 302 | } |
| 303 | 303 | // Reset class variables |
| 304 | 304 | $this->reset(); |
@@ -23,16 +23,16 @@ |
||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function buildQueryStrSingleFromArr($row = array()){ |
| 26 | - $ar = []; |
|
| 27 | - $query = "UPDATE ".$this->table." SET "; |
|
| 28 | - foreach($row as $key => $val){ |
|
| 29 | - $ar[':'.$key] = $val; |
|
| 30 | - if($key == 'id') continue; |
|
| 31 | - $query.= $this->qb->quote($key)." =:".$key.","; |
|
| 32 | - } |
|
| 33 | - $query = rtrim($query, ","); |
|
| 26 | + $ar = []; |
|
| 27 | + $query = "UPDATE ".$this->table." SET "; |
|
| 28 | + foreach($row as $key => $val){ |
|
| 29 | + $ar[':'.$key] = $val; |
|
| 30 | + if($key == 'id') continue; |
|
| 31 | + $query.= $this->qb->quote($key)." =:".$key.","; |
|
| 32 | + } |
|
| 33 | + $query = rtrim($query, ","); |
|
| 34 | 34 | |
| 35 | - return ['ar' => $ar, 'query' => $query]; |
|
| 35 | + return ['ar' => $ar, 'query' => $query]; |
|
| 36 | 36 | } |
| 37 | 37 | public function createQuery($row){ |
| 38 | 38 | $ar = []; |
@@ -27,7 +27,9 @@ |
||
| 27 | 27 | $query = "UPDATE ".$this->table." SET "; |
| 28 | 28 | foreach($row as $key => $val){ |
| 29 | 29 | $ar[':'.$key] = $val; |
| 30 | - if($key == 'id') continue; |
|
| 30 | + if($key == 'id') { |
|
| 31 | + continue; |
|
| 32 | + } |
|
| 31 | 33 | $query.= $this->qb->quote($key)." =:".$key.","; |
| 32 | 34 | } |
| 33 | 35 | $query = rtrim($query, ","); |
@@ -78,21 +78,21 @@ |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | private function buildLimitQuery($limit, $offset, $query = array()){ |
| 81 | - $limitQuery = []; |
|
| 82 | - if (!empty($limit)) { |
|
| 83 | - $query[] = 'LIMIT'; |
|
| 81 | + $limitQuery = []; |
|
| 82 | + if (!empty($limit)) { |
|
| 83 | + $query[] = 'LIMIT'; |
|
| 84 | 84 | |
| 85 | - if (!empty($offset)) { |
|
| 86 | - $query[] = $offset.','; |
|
| 87 | - } |
|
| 85 | + if (!empty($offset)) { |
|
| 86 | + $query[] = $offset.','; |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - $query[] = $limit; |
|
| 90 | - } |
|
| 89 | + $query[] = $limit; |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - if (count($limitQuery)) { |
|
| 93 | - $query = array_merge($query, $limitQuery); |
|
| 94 | - } |
|
| 95 | - return $query; |
|
| 92 | + if (count($limitQuery)) { |
|
| 93 | + $query = array_merge($query, $limitQuery); |
|
| 94 | + } |
|
| 95 | + return $query; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | public function buildQuery(array $params) |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | private function checkMultipleInsert($rows = array()){ |
| 69 | - return is_array($rows) && isset($rows[0]) && is_array($rows[0]); |
|
| 69 | + return is_array($rows) && isset($rows[0]) && is_array($rows[0]); |
|
| 70 | 70 | } |
| 71 | 71 | /** |
| 72 | 72 | * It inserts the new rows |