|
@@ -1026,7 +1026,7 @@ discard block |
|
|
block discarded – undo |
|
1026
|
1026
|
sort($tables); |
|
1027
|
1027
|
|
|
1028
|
1028
|
return $this->fromCache($this->cachePrefix.'_linkbetweeninheritedtables_'.implode('__split__', $tables), |
|
1029
|
|
- function () use ($tables) { |
|
|
1029
|
+ function() use ($tables) { |
|
1030
|
1030
|
return $this->_getLinkBetweenInheritedTablesWithoutCache($tables); |
|
1031
|
1031
|
}); |
|
1032
|
1032
|
} |
|
@@ -1073,7 +1073,7 @@ discard block |
|
|
block discarded – undo |
|
1073
|
1073
|
*/ |
|
1074
|
1074
|
public function _getRelatedTablesByInheritance($table) |
|
1075
|
1075
|
{ |
|
1076
|
|
- return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function () use ($table) { |
|
|
1076
|
+ return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function() use ($table) { |
|
1077
|
1077
|
return $this->_getRelatedTablesByInheritanceWithoutCache($table); |
|
1078
|
1078
|
}); |
|
1079
|
1079
|
} |
|
@@ -1132,7 +1132,7 @@ discard block |
|
|
block discarded – undo |
|
1132
|
1132
|
*/ |
|
1133
|
1133
|
private function getParentRelationshipForeignKeys($tableName) |
|
1134
|
1134
|
{ |
|
1135
|
|
- return $this->fromCache($this->cachePrefix.'_parentrelationshipfks_'.$tableName, function () use ($tableName) { |
|
|
1135
|
+ return $this->fromCache($this->cachePrefix.'_parentrelationshipfks_'.$tableName, function() use ($tableName) { |
|
1136
|
1136
|
return $this->getParentRelationshipForeignKeysWithoutCache($tableName); |
|
1137
|
1137
|
}); |
|
1138
|
1138
|
} |
|
@@ -1161,7 +1161,7 @@ discard block |
|
|
block discarded – undo |
|
1161
|
1161
|
*/ |
|
1162
|
1162
|
private function getChildrenRelationshipForeignKeys($tableName) |
|
1163
|
1163
|
{ |
|
1164
|
|
- return $this->fromCache($this->cachePrefix.'_childrenrelationshipfks_'.$tableName, function () use ($tableName) { |
|
|
1164
|
+ return $this->fromCache($this->cachePrefix.'_childrenrelationshipfks_'.$tableName, function() use ($tableName) { |
|
1165
|
1165
|
return $this->getChildrenRelationshipForeignKeysWithoutCache($tableName); |
|
1166
|
1166
|
}); |
|
1167
|
1167
|
} |
|
@@ -1176,7 +1176,7 @@ discard block |
|
|
block discarded – undo |
|
1176
|
1176
|
$children = $this->schemaAnalyzer->getChildrenRelationships($tableName); |
|
1177
|
1177
|
|
|
1178
|
1178
|
if (!empty($children)) { |
|
1179
|
|
- $fksTables = array_map(function (ForeignKeyConstraint $fk) { |
|
|
1179
|
+ $fksTables = array_map(function(ForeignKeyConstraint $fk) { |
|
1180
|
1180
|
return $this->getChildrenRelationshipForeignKeys($fk->getLocalTableName()); |
|
1181
|
1181
|
}, $children); |
|
1182
|
1182
|
|
|
@@ -1354,9 +1354,9 @@ discard block |
|
|
block discarded – undo |
|
1354
|
1354
|
|
|
1355
|
1355
|
$sql = 'SELECT DISTINCT '.implode(', ', array_map(function($columnDesc) use ($mainTable) { |
|
1356
|
1356
|
return $this->connection->quoteIdentifier($mainTable).'.'.$this->connection->quoteIdentifier($columnDesc['column']); |
|
1357
|
|
- }, $columnDescList)) .' FROM '.$from; |
|
|
1357
|
+ }, $columnDescList)).' FROM '.$from; |
|
1358
|
1358
|
|
|
1359
|
|
- if (count($allFetchedTables) > 1) { |
|
|
1359
|
+ if (count($allFetchedTables)>1) { |
|
1360
|
1360
|
list($columnDescList, $columnsList) = $this->getColumnsList($mainTable, []); |
|
1361
|
1361
|
} |
|
1362
|
1362
|
|
|
@@ -1541,7 +1541,7 @@ discard block |
|
|
block discarded – undo |
|
1541
|
1541
|
$objects = $this->findObjects($mainTable, $filter, $parameters, null, $additionalTablesFetch, self::MODE_ARRAY, $className); |
|
1542
|
1542
|
$page = $objects->take(0, 2); |
|
1543
|
1543
|
$count = $page->count(); |
|
1544
|
|
- if ($count > 1) { |
|
|
1544
|
+ if ($count>1) { |
|
1545
|
1545
|
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."); |
|
1546
|
1546
|
} elseif ($count === 0) { |
|
1547
|
1547
|
return; |
|
@@ -1568,7 +1568,7 @@ discard block |
|
|
block discarded – undo |
|
1568
|
1568
|
$objects = $this->findObjectsFromSql($mainTable, $from, $filter, $parameters, null, self::MODE_ARRAY, $className); |
|
1569
|
1569
|
$page = $objects->take(0, 2); |
|
1570
|
1570
|
$count = $page->count(); |
|
1571
|
|
- if ($count > 1) { |
|
|
1571
|
+ if ($count>1) { |
|
1572
|
1572
|
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."); |
|
1573
|
1573
|
} elseif ($count === 0) { |
|
1574
|
1574
|
return; |
|
@@ -1685,7 +1685,7 @@ discard block |
|
|
block discarded – undo |
|
1685
|
1685
|
$remoteTable = $remoteFk->getForeignTableName(); |
|
1686
|
1686
|
|
|
1687
|
1687
|
$primaryKeys = $this->getPrimaryKeyValues($bean); |
|
1688
|
|
- $columnNames = array_map(function ($name) use ($pivotTableName) { return $pivotTableName.'.'.$name; }, $localFk->getLocalColumns()); |
|
|
1688
|
+ $columnNames = array_map(function($name) use ($pivotTableName) { return $pivotTableName.'.'.$name; }, $localFk->getLocalColumns()); |
|
1689
|
1689
|
|
|
1690
|
1690
|
$filter = array_combine($columnNames, $primaryKeys); |
|
1691
|
1691
|
|
|
@@ -1706,7 +1706,7 @@ discard block |
|
|
block discarded – undo |
|
1706
|
1706
|
$table1 = $fks[0]->getForeignTableName(); |
|
1707
|
1707
|
$table2 = $fks[1]->getForeignTableName(); |
|
1708
|
1708
|
|
|
1709
|
|
- $beanTables = array_map(function (DbRow $dbRow) { return $dbRow->_getDbTableName(); }, $bean->_getDbRows()); |
|
|
1709
|
+ $beanTables = array_map(function(DbRow $dbRow) { return $dbRow->_getDbTableName(); }, $bean->_getDbRows()); |
|
1710
|
1710
|
|
|
1711
|
1711
|
if (in_array($table1, $beanTables)) { |
|
1712
|
1712
|
return [$fks[0], $fks[1]]; |
|
@@ -1762,7 +1762,7 @@ discard block |
|
|
block discarded – undo |
|
1762
|
1762
|
{ |
|
1763
|
1763
|
if (!isset($typesForTable[$tableName])) { |
|
1764
|
1764
|
$columns = $this->tdbmSchemaAnalyzer->getSchema()->getTable($tableName)->getColumns(); |
|
1765
|
|
- $typesForTable[$tableName] = array_map(function (Column $column) { |
|
|
1765
|
+ $typesForTable[$tableName] = array_map(function(Column $column) { |
|
1766
|
1766
|
return $column->getType(); |
|
1767
|
1767
|
}, $columns); |
|
1768
|
1768
|
} |