[BUGFIX] Use correct constructor argument for TableDiff 72/52872/6
authorStephan Großberndt <stephan@grossberndt.de>
Fri, 19 May 2017 17:33:14 +0000 (19:33 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 22 May 2017 17:04:14 +0000 (19:04 +0200)
Using the correct datatype "string" instead of a
\Doctrine\DBAL\Schema\Identifier as TableDiff->name prevents exceptions
if another SchemaEventSubscriber is registered.

Releases: master, 8.7
Resolves: #81276
Change-Id: If273a165604ff3149d8e5aba2c0b5ccbdef8102d
Reviewed-on: https://review.typo3.org/52872
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Database/Schema/ConnectionMigrator.php

index 22887ac..7ffc742 100644 (file)
@@ -399,7 +399,7 @@ class ConnectionMigrator
                 foreach ($changedTable->addedColumns as $addedColumn) {
                     $changedTables[$index . ':tbl_' . $addedColumn->getName()] = GeneralUtility::makeInstance(
                         TableDiff::class,
                 foreach ($changedTable->addedColumns as $addedColumn) {
                     $changedTables[$index . ':tbl_' . $addedColumn->getName()] = GeneralUtility::makeInstance(
                         TableDiff::class,
-                        $changedTable->getName($this->connection->getDatabasePlatform()),
+                        $changedTable->name,
                         [$addedColumn],
                         [],
                         [],
                         [$addedColumn],
                         [],
                         [],
@@ -417,7 +417,7 @@ class ConnectionMigrator
                 foreach ($changedTable->addedIndexes as $addedIndex) {
                     $changedTables[$index . ':idx_' . $addedIndex->getName()] = GeneralUtility::makeInstance(
                         TableDiff::class,
                 foreach ($changedTable->addedIndexes as $addedIndex) {
                     $changedTables[$index . ':idx_' . $addedIndex->getName()] = GeneralUtility::makeInstance(
                         TableDiff::class,
-                        $changedTable->getName($this->connection->getDatabasePlatform()),
+                        $changedTable->name,
                         [],
                         [],
                         [],
                         [],
                         [],
                         [],
@@ -436,7 +436,7 @@ class ConnectionMigrator
                     $fkIndex = $index . ':fk_' . $addedForeignKey->getName();
                     $changedTables[$fkIndex] = GeneralUtility::makeInstance(
                         TableDiff::class,
                     $fkIndex = $index . ':fk_' . $addedForeignKey->getName();
                     $changedTables[$fkIndex] = GeneralUtility::makeInstance(
                         TableDiff::class,
-                        $changedTable->getName($this->connection->getDatabasePlatform()),
+                        $changedTable->name,
                         [],
                         [],
                         [],
                         [],
                         [],
                         [],
@@ -549,7 +549,7 @@ class ConnectionMigrator
                     // Build a dedicated diff just for the current column
                     $tableDiff = GeneralUtility::makeInstance(
                         TableDiff::class,
                     // Build a dedicated diff just for the current column
                     $tableDiff = GeneralUtility::makeInstance(
                         TableDiff::class,
-                        $changedTable->getName($this->connection->getDatabasePlatform()),
+                        $changedTable->name,
                         [],
                         [$changedColumn],
                         [],
                         [],
                         [$changedColumn],
                         [],
@@ -581,7 +581,7 @@ class ConnectionMigrator
                 foreach ($changedTable->renamedIndexes as $key => $changedIndex) {
                     $indexDiff = GeneralUtility::makeInstance(
                         TableDiff::class,
                 foreach ($changedTable->renamedIndexes as $key => $changedIndex) {
                     $indexDiff = GeneralUtility::makeInstance(
                         TableDiff::class,
-                        $changedTable->getName($this->connection->getDatabasePlatform()),
+                        $changedTable->name,
                         [],
                         [],
                         [],
                         [],
                         [],
                         [],
@@ -612,7 +612,7 @@ class ConnectionMigrator
                 // argument to pass in renamed indexes.
                 $tableDiff = GeneralUtility::makeInstance(
                     TableDiff::class,
                 // argument to pass in renamed indexes.
                 $tableDiff = GeneralUtility::makeInstance(
                     TableDiff::class,
-                    $changedTable->getName($this->connection->getDatabasePlatform()),
+                    $changedTable->name,
                     [],
                     [],
                     [],
                     [],
                     [],
                     [],
@@ -648,7 +648,7 @@ class ConnectionMigrator
             if (count($changedTable->changedForeignKeys) !== 0) {
                 $tableDiff = GeneralUtility::makeInstance(
                     TableDiff::class,
             if (count($changedTable->changedForeignKeys) !== 0) {
                 $tableDiff = GeneralUtility::makeInstance(
                     TableDiff::class,
-                    $changedTable->getName($this->connection->getDatabasePlatform()),
+                    $changedTable->name,
                     [],
                     [],
                     [],
                     [],
                     [],
                     [],
@@ -717,7 +717,7 @@ class ConnectionMigrator
             foreach ($statements as $statement) {
                 $updateSuggestions['change_table'][md5($statement)] = $statement;
             }
             foreach ($statements as $statement) {
                 $updateSuggestions['change_table'][md5($statement)] = $statement;
             }
-            $updateSuggestions['tables_count'][md5($statements[0])] = $this->getTableRecordCount($tableDiff->name);
+            $updateSuggestions['tables_count'][md5($statements[0])] = $this->getTableRecordCount((string)$tableDiff->name);
         }
 
         return $updateSuggestions;
         }
 
         return $updateSuggestions;
@@ -753,7 +753,7 @@ class ConnectionMigrator
 
                 $changedTables[$index . ':' . $changedColumn->column->getName()] = GeneralUtility::makeInstance(
                     TableDiff::class,
 
                 $changedTables[$index . ':' . $changedColumn->column->getName()] = GeneralUtility::makeInstance(
                     TableDiff::class,
-                    $changedTable->getName($this->connection->getDatabasePlatform()),
+                    $changedTable->name,
                     [],
                     [$changedColumn],
                     [],
                     [],
                     [$changedColumn],
                     [],
@@ -801,7 +801,7 @@ class ConnectionMigrator
                 foreach ($changedTable->removedColumns as $removedColumn) {
                     $changedTables[$index . ':tbl_' . $removedColumn->getName()] = GeneralUtility::makeInstance(
                         TableDiff::class,
                 foreach ($changedTable->removedColumns as $removedColumn) {
                     $changedTables[$index . ':tbl_' . $removedColumn->getName()] = GeneralUtility::makeInstance(
                         TableDiff::class,
-                        $changedTable->getName($this->connection->getDatabasePlatform()),
+                        $changedTable->name,
                         [],
                         [],
                         [$removedColumn],
                         [],
                         [],
                         [$removedColumn],
@@ -819,7 +819,7 @@ class ConnectionMigrator
                 foreach ($changedTable->removedIndexes as $removedIndex) {
                     $changedTables[$index . ':idx_' . $removedIndex->getName()] = GeneralUtility::makeInstance(
                         TableDiff::class,
                 foreach ($changedTable->removedIndexes as $removedIndex) {
                     $changedTables[$index . ':idx_' . $removedIndex->getName()] = GeneralUtility::makeInstance(
                         TableDiff::class,
-                        $changedTable->getName($this->connection->getDatabasePlatform()),
+                        $changedTable->name,
                         [],
                         [],
                         [],
                         [],
                         [],
                         [],
@@ -838,7 +838,7 @@ class ConnectionMigrator
                     $fkIndex = $index . ':fk_' . $removedForeignKey->getName();
                     $changedTables[$fkIndex] = GeneralUtility::makeInstance(
                         TableDiff::class,
                     $fkIndex = $index . ':fk_' . $removedForeignKey->getName();
                     $changedTables[$fkIndex] = GeneralUtility::makeInstance(
                         TableDiff::class,
-                        $changedTable->getName($this->connection->getDatabasePlatform()),
+                        $changedTable->name,
                         [],
                         [],
                         [],
                         [],
                         [],
                         [],