@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function create($associative1DArray, $tableName, $dbConn = Null) |
| 44 | 44 | { |
| 45 | - $unexpectedFields = self::checkIfMagicSetterContainsIsSameAsClassModel($this->tableFields,$associative1DArray); |
|
| 45 | + $unexpectedFields = self::checkIfMagicSetterContainsIsSameAsClassModel($this->tableFields, $associative1DArray); |
|
| 46 | 46 | |
| 47 | 47 | if (count($unexpectedFields) > 0) |
| 48 | 48 | { |
| 49 | - throw TableFieldUndefinedException::fieldsNotDefinedException($unexpectedFields,"needs to be created as table field"); |
|
| 49 | + throw TableFieldUndefinedException::fieldsNotDefinedException($unexpectedFields, "needs to be created as table field"); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | unset($this->tableFields[0]); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $insertQuery = 'INSERT INTO '.$tableName; |
| 59 | 59 | |
| 60 | - $TableValues = implode(',',array_keys($associative1DArray)); |
|
| 60 | + $TableValues = implode(',', array_keys($associative1DArray)); |
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | var_dump($associative1DArray); |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | $splittedTableValues = implode(',', $FormValues); |
| 70 | 70 | |
| 71 | - $insertQuery.= ' ('.$TableValues.')'; |
|
| 71 | + $insertQuery .= ' ('.$TableValues.')'; |
|
| 72 | 72 | |
| 73 | - $insertQuery.= ' VALUES ('.$splittedTableValues.')'; |
|
| 73 | + $insertQuery .= ' VALUES ('.$splittedTableValues.')'; |
|
| 74 | 74 | |
| 75 | 75 | $executeQuery = $dbConn->exec($insertQuery); |
| 76 | 76 | |
| 77 | - return $executeQuery ? : false; |
|
| 77 | + return $executeQuery ?: false; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /* |
@@ -95,15 +95,15 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | unset($associative1DArray['id']); |
| 97 | 97 | |
| 98 | - $unexpectedFields = self::checkIfMagicSetterContainsIsSameAsClassModel($this->tableFields,$associative1DArray); |
|
| 98 | + $unexpectedFields = self::checkIfMagicSetterContainsIsSameAsClassModel($this->tableFields, $associative1DArray); |
|
| 99 | 99 | |
| 100 | 100 | if (count($unexpectedFields) > 0) { |
| 101 | 101 | |
| 102 | - throw TableFieldUndefinedException::fieldsNotDefinedException($unexpectedFields,"needs to be created as table field"); |
|
| 102 | + throw TableFieldUndefinedException::fieldsNotDefinedException($unexpectedFields, "needs to be created as table field"); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
| 106 | - foreach($associative1DArray as $field => $value) |
|
| 106 | + foreach ($associative1DArray as $field => $value) |
|
| 107 | 107 | { |
| 108 | 108 | $sql .= "`$field` = '$value'".","; |
| 109 | 109 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | $boolResponse = $stmt->execute(); |
| 121 | 121 | |
| 122 | - return $boolResponse ? : false; |
|
| 122 | + return $boolResponse ?: false; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - $sql = $id ? 'SELECT * FROM '.$tableName.' WHERE id = '.$id : 'SELECT * FROM '.$tableName; |
|
| 140 | + $sql = $id ? 'SELECT * FROM '.$tableName.' WHERE id = '.$id : 'SELECT * FROM '.$tableName; |
|
| 141 | 141 | |
| 142 | 142 | try { |
| 143 | 143 | $stmt = $dbConn->prepare($sql); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | $results = $stmt->fetchAll(PDO::FETCH_ASSOC); |
| 153 | 153 | |
| 154 | - foreach($results as $result) { |
|
| 154 | + foreach ($results as $result) { |
|
| 155 | 155 | |
| 156 | 156 | array_push($tableData, $result); |
| 157 | 157 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | $boolResponse = $dbConn->exec($sql); |
| 179 | 179 | |
| 180 | - return $boolResponse ? : false; |
|
| 180 | + return $boolResponse ?: false; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | foreach ($userSetterArray as $key => $val) |
| 194 | 194 | { |
| 195 | - if (!in_array($key,$tableColumn)) { |
|
| 195 | + if (!in_array($key, $tableColumn)) { |
|
| 196 | 196 | |
| 197 | 197 | $unexpectedFields[] = $key; |
| 198 | 198 | } |
@@ -208,11 +208,11 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | private function prepareUpdateQuery($sql) |
| 210 | 210 | { |
| 211 | - $splittedQuery = explode(",",$sql); |
|
| 211 | + $splittedQuery = explode(",", $sql); |
|
| 212 | 212 | |
| 213 | 213 | array_pop($splittedQuery); |
| 214 | 214 | |
| 215 | - $mergeData = implode(",",$splittedQuery); |
|
| 215 | + $mergeData = implode(",", $splittedQuery); |
|
| 216 | 216 | |
| 217 | 217 | return $mergeData; |
| 218 | 218 | } |