@@ -55,19 +55,19 @@ discard block |
||
55 | 55 | ]; |
56 | 56 | } |
57 | 57 | |
58 | - $sql = 'SELECT DISTINCT '.implode(', ', array_map(function ($columnDesc) { |
|
58 | + $sql = 'SELECT DISTINCT '.implode(', ', array_map(function($columnDesc) { |
|
59 | 59 | return $this->tdbmService->getConnection()->quoteIdentifier($this->mainTable).'.'.$this->tdbmService->getConnection()->quoteIdentifier($columnDesc['column']); |
60 | 60 | }, $columnDescList)).' FROM '.$this->from; |
61 | 61 | |
62 | - if (count($allFetchedTables) > 1) { |
|
62 | + if (count($allFetchedTables)>1) { |
|
63 | 63 | list($columnDescList, $columnsList, $orderString) = $this->getColumnsList($this->mainTable, [], $this->orderBy); |
64 | 64 | } elseif ($this->orderBy) { |
65 | - list(, , $orderString) = $this->getColumnsList($this->mainTable, [], $this->orderBy); |
|
65 | + list(,, $orderString) = $this->getColumnsList($this->mainTable, [], $this->orderBy); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // Let's compute the COUNT. |
69 | 69 | $pkColumnNames = $this->schema->getTable($this->mainTable)->getPrimaryKeyColumns(); |
70 | - $pkColumnNames = array_map(function ($pkColumn) { |
|
70 | + $pkColumnNames = array_map(function($pkColumn) { |
|
71 | 71 | return $this->tdbmService->getConnection()->quoteIdentifier($this->mainTable).'.'.$this->tdbmService->getConnection()->quoteIdentifier($pkColumn); |
72 | 72 | }, $pkColumnNames); |
73 | 73 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | private function getParentRelationshipForeignKeys($tableName) |
130 | 130 | { |
131 | - return $this->fromCache($this->cachePrefix.'_parentrelationshipfks_'.$tableName, function () use ($tableName) { |
|
131 | + return $this->fromCache($this->cachePrefix.'_parentrelationshipfks_'.$tableName, function() use ($tableName) { |
|
132 | 132 | return $this->getParentRelationshipForeignKeysWithoutCache($tableName); |
133 | 133 | }); |
134 | 134 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | private function getChildrenRelationshipForeignKeys(string $tableName) : array |
159 | 159 | { |
160 | - return $this->fromCache($this->cachePrefix.'_childrenrelationshipfks_'.$tableName, function () use ($tableName) { |
|
160 | + return $this->fromCache($this->cachePrefix.'_childrenrelationshipfks_'.$tableName, function() use ($tableName) { |
|
161 | 161 | return $this->getChildrenRelationshipForeignKeysWithoutCache($tableName); |
162 | 162 | }); |
163 | 163 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $children = $this->schemaAnalyzer->getChildrenRelationships($tableName); |
173 | 173 | |
174 | 174 | if (!empty($children)) { |
175 | - $fksTables = array_map(function (ForeignKeyConstraint $fk) { |
|
175 | + $fksTables = array_map(function(ForeignKeyConstraint $fk) { |
|
176 | 176 | return $this->getChildrenRelationshipForeignKeys($fk->getLocalTableName()); |
177 | 177 | }, $children); |
178 | 178 |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function getConstructorProperties() |
94 | 94 | { |
95 | - $constructorProperties = array_filter($this->beanPropertyDescriptors, function (AbstractBeanPropertyDescriptor $property) { |
|
95 | + $constructorProperties = array_filter($this->beanPropertyDescriptors, function(AbstractBeanPropertyDescriptor $property) { |
|
96 | 96 | return $property->isCompulsory(); |
97 | 97 | }); |
98 | 98 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | public function getPropertiesWithDefault() |
108 | 108 | { |
109 | 109 | $properties = $this->getPropertiesForTable($this->table); |
110 | - $defaultProperties = array_filter($properties, function (AbstractBeanPropertyDescriptor $property) { |
|
110 | + $defaultProperties = array_filter($properties, function(AbstractBeanPropertyDescriptor $property) { |
|
111 | 111 | return $property->hasDefault(); |
112 | 112 | }); |
113 | 113 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function getExposedProperties() |
123 | 123 | { |
124 | - $exposedProperties = array_filter($this->beanPropertyDescriptors, function (AbstractBeanPropertyDescriptor $property) { |
|
124 | + $exposedProperties = array_filter($this->beanPropertyDescriptors, function(AbstractBeanPropertyDescriptor $property) { |
|
125 | 125 | return $property->getTable()->getName() == $this->table->getName(); |
126 | 126 | }); |
127 | 127 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | } |
332 | 332 | |
333 | 333 | foreach ($descriptorsByMethodName as $descriptorsForMethodName) { |
334 | - if (count($descriptorsForMethodName) > 1) { |
|
334 | + if (count($descriptorsForMethodName)>1) { |
|
335 | 335 | foreach ($descriptorsForMethodName as $descriptor) { |
336 | 336 | $descriptor->useAlternativeName(); |
337 | 337 | } |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | |
425 | 425 | $classes = $this->generateExtendsAndUseStatements($parentFk); |
426 | 426 | |
427 | - $uses = array_map(function ($className) use ($beannamespace) { |
|
427 | + $uses = array_map(function($className) use ($beannamespace) { |
|
428 | 428 | return 'use '.$beannamespace.'\\'.$className.";\n"; |
429 | 429 | }, $classes); |
430 | 430 | $use = implode('', $uses); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | private function checkTableName($tableName = null) |
198 | 198 | { |
199 | 199 | if ($tableName === null) { |
200 | - if (count($this->dbRows) > 1) { |
|
200 | + if (count($this->dbRows)>1) { |
|
201 | 201 | throw new TDBMException('This object is based on several tables. You must specify which table you are retrieving data from.'); |
202 | 202 | } elseif (count($this->dbRows) === 1) { |
203 | 203 | $tableName = array_keys($this->dbRows)[0]; |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | protected function set($var, $value, $tableName = null) |
222 | 222 | { |
223 | 223 | if ($tableName === null) { |
224 | - if (count($this->dbRows) > 1) { |
|
224 | + if (count($this->dbRows)>1) { |
|
225 | 225 | throw new TDBMException('This object is based on several tables. You must specify which table you are retrieving data from.'); |
226 | 226 | } elseif (count($this->dbRows) === 1) { |
227 | 227 | $tableName = array_keys($this->dbRows)[0]; |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | protected function setRef($foreignKeyName, AbstractTDBMObject $bean = null, $tableName = null) |
248 | 248 | { |
249 | 249 | if ($tableName === null) { |
250 | - if (count($this->dbRows) > 1) { |
|
250 | + if (count($this->dbRows)>1) { |
|
251 | 251 | throw new TDBMException('This object is based on several tables. You must specify which table you are retrieving data from.'); |
252 | 252 | } elseif (count($this->dbRows) === 1) { |
253 | 253 | $tableName = array_keys($this->dbRows)[0]; |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Mouf\Database\TDBM\Utils; |
6 | 6 |
@@ -378,11 +378,11 @@ |
||
378 | 378 | throw TDBMMissingReferenceException::referenceDeleted($this->dbTableName, $reference); |
379 | 379 | } |
380 | 380 | $pkValues = array_values($firstRefDbRow->_getPrimaryKeys()); |
381 | - for ($i = 0, $count = count($localColumns); $i < $count; ++$i) { |
|
381 | + for ($i = 0, $count = count($localColumns); $i<$count; ++$i) { |
|
382 | 382 | $dbRow[$localColumns[$i]] = $pkValues[$i]; |
383 | 383 | } |
384 | 384 | } else { |
385 | - for ($i = 0, $count = count($localColumns); $i < $count; ++$i) { |
|
385 | + for ($i = 0, $count = count($localColumns); $i<$count; ++$i) { |
|
386 | 386 | $dbRow[$localColumns[$i]] = null; |
387 | 387 | } |
388 | 388 | } |