@@ -58,7 +58,7 @@ |
||
58 | 58 | $count = 0; |
59 | 59 | while ($result = $stmt->fetch()) { |
60 | 60 | $name = $result['column_name']; |
61 | - $count ++; |
|
61 | + $count++; |
|
62 | 62 | } |
63 | 63 | $stmt->closeCursor(); |
64 | 64 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getPrimaryKeyColumn(string $table, \Nkey\Caribu\Orm\Orm $orm): string |
42 | 42 | { |
43 | - $query = "select ccu.column_name as column_name from information_schema.constraint_column_usage ccu " . "inner join information_schema.table_constraints tc on ccu.constraint_name = tc.constraint_name " . "where tc.table_catalog = '{schema}' AND tc.table_name = '{table}'"; |
|
43 | + $query = "select ccu.column_name as column_name from information_schema.constraint_column_usage ccu "."inner join information_schema.table_constraints tc on ccu.constraint_name = tc.constraint_name "."where tc.table_catalog = '{schema}' AND tc.table_name = '{table}'"; |
|
44 | 44 | |
45 | 45 | return $this->getPrimaryColumnViaSql($orm, $table, $query); |
46 | 46 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function getTypeQuery(): string |
91 | 91 | { |
92 | - $query = "select data_type from information_schema.columns where table_catalog = '{schema}' " . "and table_name = '{table}' and column_name = '{column}'"; |
|
92 | + $query = "select data_type from information_schema.columns where table_catalog = '{schema}' "."and table_name = '{table}' and column_name = '{column}'"; |
|
93 | 93 | |
94 | 94 | return $query; |
95 | 95 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | { |
140 | 140 | $sequenceName = null; |
141 | 141 | |
142 | - $query = "select column_default from information_schema.columns where table_catalog = '{schema}' " . "AND table_name = '{table}' and column_name = '{column}'"; |
|
142 | + $query = "select column_default from information_schema.columns where table_catalog = '{schema}' "."AND table_name = '{table}' and column_name = '{column}'"; |
|
143 | 143 | |
144 | 144 | $sql = $this->interp($query, array( |
145 | 145 | 'schema' => $orm->getSchema(), |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function getPrimaryKeyColumn(string $table, \Nkey\Caribu\Orm\Orm $orm): string |
40 | 40 | { |
41 | - $query = "SELECT `COLUMN_NAME` as column_name FROM `information_schema`.`columns` " . // |
|
41 | + $query = "SELECT `COLUMN_NAME` as column_name FROM `information_schema`.`columns` ".// |
|
42 | 42 | "WHERE `TABLE_NAME` = '{table}' AND `TABLE_SCHEMA` = '{schema}' AND `COLUMN_KEY` = 'PRI'"; |
43 | 43 | |
44 | 44 | return $this->getPrimaryColumnViaSql($orm, $table, $query); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | protected function getTypeQuery(): string |
98 | 98 | { |
99 | - $query = "SELECT `DATA_TYPE` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = '{schema}' " . "AND `TABLE_NAME` = '{table}' AND `COLUMN_NAME` = '{column}'"; |
|
99 | + $query = "SELECT `DATA_TYPE` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = '{schema}' "."AND `TABLE_NAME` = '{table}' AND `COLUMN_NAME` = '{column}'"; |
|
100 | 100 | |
101 | 101 | return $query; |
102 | 102 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | */ |
64 | 64 | public function getDefaultPort(): int |
65 | 65 | { |
66 | - return - 1; |
|
66 | + return -1; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -59,7 +59,7 @@ |
||
59 | 59 | try { |
60 | 60 | $rfMethod = new \ReflectionMethod($class, $method); |
61 | 61 | $primaryKey = $rfMethod->invoke($object); |
62 | - if (! $onlyValue) { |
|
62 | + if (!$onlyValue) { |
|
63 | 63 | $primaryKey = array( |
64 | 64 | $pkCol => $primaryKey |
65 | 65 | ); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $pkColumn => $id |
87 | 87 | )); |
88 | 88 | |
89 | - if (! $result || is_array($result)) { |
|
89 | + if (!$result || is_array($result)) { |
|
90 | 90 | throw new OrmException("More than one entity found (expected exactly one)"); |
91 | 91 | } |
92 | 92 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $placeHolder = str_replace('.', '_', $criterion); |
136 | 136 | $placeHolder = str_replace('OR ', 'OR_', $placeHolder); |
137 | 137 | $value = str_ireplace('LIKE ', '', $value); |
138 | - $statement->bindValue(":" . $placeHolder, $value); |
|
138 | + $statement->bindValue(":".$placeHolder, $value); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | $statement->execute(); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $results[] = self::map($result, $class, $instance); |
152 | 152 | } |
153 | 153 | |
154 | - if (! $asList && count($results) == 1) { |
|
154 | + if (!$asList && count($results) == 1) { |
|
155 | 155 | $results = $results[0]; |
156 | 156 | } |
157 | 157 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | $instance->getDbType()->lock($tableName, IType::LOCK_TYPE_WRITE, $instance); |
234 | 234 | $statement->execute(); |
235 | - if (! $primaryKeyValue) { |
|
235 | + if (!$primaryKeyValue) { |
|
236 | 236 | $pk = $connection->lastInsertId($instance->getDbType() |
237 | 237 | ->getSequenceNameForColumn($tableName, $primaryKeyCol, $instance)); |
238 | 238 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | unset($statement); |
242 | 242 | |
243 | - if (! $primaryKeyValue) { |
|
243 | + if (!$primaryKeyValue) { |
|
244 | 244 | $this->setPrimaryKey($class, $entity, $pk); |
245 | 245 | } |
246 | 246 |
@@ -50,7 +50,7 @@ |
||
50 | 50 | */ |
51 | 51 | private static function fullQualifiedName(string $ns, string $class): string |
52 | 52 | { |
53 | - if (! class_exists($class)) { |
|
53 | + if (!class_exists($class)) { |
|
54 | 54 | $class = sprintf("\\%s\\%s", $ns, $class); |
55 | 55 | } |
56 | 56 | return $class; |
@@ -38,8 +38,8 @@ |
||
38 | 38 | */ |
39 | 39 | private static function boolval($value): bool |
40 | 40 | { |
41 | - if (! function_exists('boolval')) { |
|
42 | - return (bool) $value; |
|
41 | + if (!function_exists('boolval')) { |
|
42 | + return (bool)$value; |
|
43 | 43 | } |
44 | 44 | return boolval($value); |
45 | 45 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | private static function convertDate(string $value): \DateTime |
34 | 34 | { |
35 | - $value = trim($value); |
|
35 | + $value = trim($value); |
|
36 | 36 | try { |
37 | 37 | $date = new \DateTime(sprintf("@%s", $value)); |
38 | 38 | } catch (\Exception $exception) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | if (! $date) { |
55 | - throw new OrmException("Could not parse string '".$value."' as date"); |
|
55 | + throw new OrmException("Could not parse string '".$value."' as date"); |
|
56 | 56 | } |
57 | 57 | } catch (\Exception $exception) { |
58 | 58 | throw OrmException::fromPrevious($exception); |
@@ -39,19 +39,19 @@ discard block |
||
39 | 39 | try { |
40 | 40 | $date = \DateTime::createFromFormat("Y-m-d", $value); |
41 | 41 | |
42 | - if (! $date) { |
|
42 | + if (!$date) { |
|
43 | 43 | $date = \DateTime::createFromFormat("Y-m-d H:i:s", $value); |
44 | 44 | } |
45 | 45 | |
46 | - if (! $date) { |
|
46 | + if (!$date) { |
|
47 | 47 | $date = \DateTime::createFromFormat(\DateTime::W3C, $value); |
48 | 48 | } |
49 | 49 | |
50 | - if (! $date) { |
|
50 | + if (!$date) { |
|
51 | 51 | $date = \DateTime::createFromFormat(\DateTime::ISO8601, $value); |
52 | 52 | } |
53 | 53 | |
54 | - if (! $date) { |
|
54 | + if (!$date) { |
|
55 | 55 | throw new OrmException("Could not parse string '".$value."' as date"); |
56 | 56 | } |
57 | 57 | } catch (\Exception $exception) { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | private static function convertType(string $type, $value) |
77 | 77 | { |
78 | - if (! $type) { |
|
78 | + if (!$type) { |
|
79 | 79 | return $value; |
80 | 80 | } |
81 | 81 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | return strval($value); |
104 | 104 | |
105 | 105 | default: |
106 | - if (! self::isInternalClass($type)) { |
|
106 | + if (!self::isInternalClass($type)) { |
|
107 | 107 | return $value; |
108 | 108 | } |
109 | 109 | } |