@@ -39,7 +39,7 @@ |
||
| 39 | 39 | $sql = 'SELECT DISTINCT '.implode(', ', $columnsList).' FROM MAGICJOIN('.$this->mainTable.')'; |
| 40 | 40 | |
| 41 | 41 | $pkColumnNames = $this->schema->getTable($this->mainTable)->getPrimaryKeyColumns(); |
| 42 | - $pkColumnNames = array_map(function ($pkColumn) { |
|
| 42 | + $pkColumnNames = array_map(function($pkColumn) { |
|
| 43 | 43 | return $this->tdbmService->getConnection()->quoteIdentifier($this->mainTable).'.'.$this->tdbmService->getConnection()->quoteIdentifier($pkColumn); |
| 44 | 44 | }, $pkColumnNames); |
| 45 | 45 | |
@@ -63,17 +63,17 @@ discard block |
||
| 63 | 63 | ]; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - $sql = 'SELECT DISTINCT '.implode(', ', array_map(function ($columnDesc) { |
|
| 66 | + $sql = 'SELECT DISTINCT '.implode(', ', array_map(function($columnDesc) { |
|
| 67 | 67 | return $this->tdbmService->getConnection()->quoteIdentifier($this->mainTable).'.'.$this->tdbmService->getConnection()->quoteIdentifier($columnDesc['column']); |
| 68 | 68 | }, $columnDescList)).' FROM '.$this->from; |
| 69 | 69 | |
| 70 | - if (count($allFetchedTables) > 1) { |
|
| 70 | + if (count($allFetchedTables)>1) { |
|
| 71 | 71 | list($columnDescList, $columnsList, $orderString) = $this->getColumnsList($this->mainTable, [], $this->orderBy); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Let's compute the COUNT. |
| 75 | 75 | $pkColumnNames = $this->schema->getTable($this->mainTable)->getPrimaryKeyColumns(); |
| 76 | - $pkColumnNames = array_map(function ($pkColumn) { |
|
| 76 | + $pkColumnNames = array_map(function($pkColumn) { |
|
| 77 | 77 | return $this->tdbmService->getConnection()->quoteIdentifier($this->mainTable).'.'.$this->tdbmService->getConnection()->quoteIdentifier($pkColumn); |
| 78 | 78 | }, $pkColumnNames); |
| 79 | 79 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | private function getParentRelationshipForeignKeys($tableName) |
| 133 | 133 | { |
| 134 | - return $this->fromCache($this->cachePrefix.'_parentrelationshipfks_'.$tableName, function () use ($tableName) { |
|
| 134 | + return $this->fromCache($this->cachePrefix.'_parentrelationshipfks_'.$tableName, function() use ($tableName) { |
|
| 135 | 135 | return $this->getParentRelationshipForeignKeysWithoutCache($tableName); |
| 136 | 136 | }); |
| 137 | 137 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | private function getChildrenRelationshipForeignKeys(string $tableName) : array |
| 162 | 162 | { |
| 163 | - return $this->fromCache($this->cachePrefix.'_childrenrelationshipfks_'.$tableName, function () use ($tableName) { |
|
| 163 | + return $this->fromCache($this->cachePrefix.'_childrenrelationshipfks_'.$tableName, function() use ($tableName) { |
|
| 164 | 164 | return $this->getChildrenRelationshipForeignKeysWithoutCache($tableName); |
| 165 | 165 | }); |
| 166 | 166 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $children = $this->schemaAnalyzer->getChildrenRelationships($tableName); |
| 176 | 176 | |
| 177 | 177 | if (!empty($children)) { |
| 178 | - $fksTables = array_map(function (ForeignKeyConstraint $fk) { |
|
| 178 | + $fksTables = array_map(function(ForeignKeyConstraint $fk) { |
|
| 179 | 179 | return $this->getChildrenRelationshipForeignKeys($fk->getLocalTableName()); |
| 180 | 180 | }, $children); |
| 181 | 181 | |
@@ -1064,7 +1064,7 @@ discard block |
||
| 1064 | 1064 | sort($tables); |
| 1065 | 1065 | |
| 1066 | 1066 | return $this->fromCache($this->cachePrefix.'_linkbetweeninheritedtables_'.implode('__split__', $tables), |
| 1067 | - function () use ($tables) { |
|
| 1067 | + function() use ($tables) { |
|
| 1068 | 1068 | return $this->_getLinkBetweenInheritedTablesWithoutCache($tables); |
| 1069 | 1069 | }); |
| 1070 | 1070 | } |
@@ -1111,7 +1111,7 @@ discard block |
||
| 1111 | 1111 | */ |
| 1112 | 1112 | public function _getRelatedTablesByInheritance($table) |
| 1113 | 1113 | { |
| 1114 | - return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function () use ($table) { |
|
| 1114 | + return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function() use ($table) { |
|
| 1115 | 1115 | return $this->_getRelatedTablesByInheritanceWithoutCache($table); |
| 1116 | 1116 | }); |
| 1117 | 1117 | } |
@@ -1358,7 +1358,7 @@ discard block |
||
| 1358 | 1358 | $objects = $this->findObjects($mainTable, $filter, $parameters, null, $additionalTablesFetch, self::MODE_ARRAY, $className); |
| 1359 | 1359 | $page = $objects->take(0, 2); |
| 1360 | 1360 | $count = $page->count(); |
| 1361 | - if ($count > 1) { |
|
| 1361 | + if ($count>1) { |
|
| 1362 | 1362 | throw new DuplicateRowException("Error while querying an object for table '$mainTable': More than 1 row have been returned, but we should have received at most one."); |
| 1363 | 1363 | } elseif ($count === 0) { |
| 1364 | 1364 | return; |
@@ -1385,7 +1385,7 @@ discard block |
||
| 1385 | 1385 | $objects = $this->findObjectsFromSql($mainTable, $from, $filter, $parameters, null, self::MODE_ARRAY, $className); |
| 1386 | 1386 | $page = $objects->take(0, 2); |
| 1387 | 1387 | $count = $page->count(); |
| 1388 | - if ($count > 1) { |
|
| 1388 | + if ($count>1) { |
|
| 1389 | 1389 | throw new DuplicateRowException("Error while querying an object for table '$mainTable': More than 1 row have been returned, but we should have received at most one."); |
| 1390 | 1390 | } elseif ($count === 0) { |
| 1391 | 1391 | return; |
@@ -1503,7 +1503,7 @@ discard block |
||
| 1503 | 1503 | $remoteTable = $remoteFk->getForeignTableName(); |
| 1504 | 1504 | |
| 1505 | 1505 | $primaryKeys = $this->getPrimaryKeyValues($bean); |
| 1506 | - $columnNames = array_map(function ($name) use ($pivotTableName) { |
|
| 1506 | + $columnNames = array_map(function($name) use ($pivotTableName) { |
|
| 1507 | 1507 | return $pivotTableName.'.'.$name; |
| 1508 | 1508 | }, $localFk->getLocalColumns()); |
| 1509 | 1509 | |
@@ -1526,7 +1526,7 @@ discard block |
||
| 1526 | 1526 | $table1 = $fks[0]->getForeignTableName(); |
| 1527 | 1527 | $table2 = $fks[1]->getForeignTableName(); |
| 1528 | 1528 | |
| 1529 | - $beanTables = array_map(function (DbRow $dbRow) { |
|
| 1529 | + $beanTables = array_map(function(DbRow $dbRow) { |
|
| 1530 | 1530 | return $dbRow->_getDbTableName(); |
| 1531 | 1531 | }, $bean->_getDbRows()); |
| 1532 | 1532 | |
@@ -1584,7 +1584,7 @@ discard block |
||
| 1584 | 1584 | { |
| 1585 | 1585 | if (!isset($typesForTable[$tableName])) { |
| 1586 | 1586 | $columns = $this->tdbmSchemaAnalyzer->getSchema()->getTable($tableName)->getColumns(); |
| 1587 | - $typesForTable[$tableName] = array_map(function (Column $column) { |
|
| 1587 | + $typesForTable[$tableName] = array_map(function(Column $column) { |
|
| 1588 | 1588 | return $column->getType(); |
| 1589 | 1589 | }, $columns); |
| 1590 | 1590 | } |
@@ -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; |
| 6 | 6 | |