|
@@ -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
|
|
|
@@ -1539,7 +1539,7 @@ discard block |
|
|
block discarded – undo |
|
1539
|
1539
|
$objects = $this->findObjects($mainTable, $filter, $parameters, null, $additionalTablesFetch, self::MODE_ARRAY, $className); |
|
1540
|
1540
|
$page = $objects->take(0, 2); |
|
1541
|
1541
|
$count = $page->count(); |
|
1542
|
|
- if ($count > 1) { |
|
|
1542
|
+ if ($count>1) { |
|
1543
|
1543
|
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."); |
|
1544
|
1544
|
} elseif ($count === 0) { |
|
1545
|
1545
|
return; |
|
@@ -1566,7 +1566,7 @@ discard block |
|
|
block discarded – undo |
|
1566
|
1566
|
$objects = $this->findObjectsFromSql($mainTable, $from, $filter, $parameters, null, self::MODE_ARRAY, $className); |
|
1567
|
1567
|
$page = $objects->take(0, 2); |
|
1568
|
1568
|
$count = $page->count(); |
|
1569
|
|
- if ($count > 1) { |
|
|
1569
|
+ if ($count>1) { |
|
1570
|
1570
|
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."); |
|
1571
|
1571
|
} elseif ($count === 0) { |
|
1572
|
1572
|
return; |
|
@@ -1683,7 +1683,7 @@ discard block |
|
|
block discarded – undo |
|
1683
|
1683
|
$remoteTable = $remoteFk->getForeignTableName(); |
|
1684
|
1684
|
|
|
1685
|
1685
|
$primaryKeys = $this->getPrimaryKeyValues($bean); |
|
1686
|
|
- $columnNames = array_map(function ($name) use ($pivotTableName) { return $pivotTableName.'.'.$name; }, $localFk->getLocalColumns()); |
|
|
1686
|
+ $columnNames = array_map(function($name) use ($pivotTableName) { return $pivotTableName.'.'.$name; }, $localFk->getLocalColumns()); |
|
1687
|
1687
|
|
|
1688
|
1688
|
$filter = array_combine($columnNames, $primaryKeys); |
|
1689
|
1689
|
|
|
@@ -1704,7 +1704,7 @@ discard block |
|
|
block discarded – undo |
|
1704
|
1704
|
$table1 = $fks[0]->getForeignTableName(); |
|
1705
|
1705
|
$table2 = $fks[1]->getForeignTableName(); |
|
1706
|
1706
|
|
|
1707
|
|
- $beanTables = array_map(function (DbRow $dbRow) { return $dbRow->_getDbTableName(); }, $bean->_getDbRows()); |
|
|
1707
|
+ $beanTables = array_map(function(DbRow $dbRow) { return $dbRow->_getDbTableName(); }, $bean->_getDbRows()); |
|
1708
|
1708
|
|
|
1709
|
1709
|
if (in_array($table1, $beanTables)) { |
|
1710
|
1710
|
return [$fks[0], $fks[1]]; |
|
@@ -1760,7 +1760,7 @@ discard block |
|
|
block discarded – undo |
|
1760
|
1760
|
{ |
|
1761
|
1761
|
if (!isset($typesForTable[$tableName])) { |
|
1762
|
1762
|
$columns = $this->tdbmSchemaAnalyzer->getSchema()->getTable($tableName)->getColumns(); |
|
1763
|
|
- $typesForTable[$tableName] = array_map(function (Column $column) { |
|
|
1763
|
+ $typesForTable[$tableName] = array_map(function(Column $column) { |
|
1764
|
1764
|
return $column->getType(); |
|
1765
|
1765
|
}, $columns); |
|
1766
|
1766
|
} |