From afb6f9532a41e197dbc88ad428b3afb3113b257d Mon Sep 17 00:00:00 2001 From: Oliver Hader <oliver@typo3.org> Date: Fri, 2 Dec 2016 10:44:49 +0100 Subject: [PATCH] [FOLLOWUP][TASK] Remove support for transForeignTable in TCA Resolves: #78191 Releases: master Change-Id: I944601b8ccd2c2aa5c15bd7473eae5f4246d52a3 Reviewed-on: https://review.typo3.org/50845 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Tested-by: Wouter Wolters <typo3@wouterwolters.nl> Reviewed-by: Susanne Moog <susanne.moog@typo3.org> Tested-by: Susanne Moog <susanne.moog@typo3.org> --- .../core/Classes/Migrations/TcaMigration.php | 25 ++++++++++ .../Unit/Migrations/TcaMigrationTest.php | 49 +++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/typo3/sysext/core/Classes/Migrations/TcaMigration.php b/typo3/sysext/core/Classes/Migrations/TcaMigration.php index fa032094028f..eaf0a959039a 100644 --- a/typo3/sysext/core/Classes/Migrations/TcaMigration.php +++ b/typo3/sysext/core/Classes/Migrations/TcaMigration.php @@ -57,6 +57,7 @@ class TcaMigration $tca = $this->migrateTSconfigSoftReferences($tca); $tca = $this->migrateShowIfRteOption($tca); $tca = $this->migrateWorkspacesOptions($tca); + $tca = $this->migrateTranslationTable($tca); // @todo: if showitem/defaultExtras wizards[xy] is migrated to columnsOverrides here, enableByTypeConfig could be dropped return $tca; } @@ -872,4 +873,28 @@ class TcaMigration } return $tca; } + + /** + * Removes "transForeignTable" and "transOrigPointerTable" which has been + * used for tables "pages" and "pages_languages_overlay" in the core only. + * + * @param array $tca + * @return array Migrated TCA + */ + protected function migrateTranslationTable(array $tca) + { + foreach ($tca as $table => &$tableDefinition) { + if (!empty($tableDefinition['ctrl']['transForeignTable'])) { + unset($tableDefinition['ctrl']['transForeignTable']); + $this->messages[] = 'The TCA setting \'transForeignTable\' was removed ' + . 'in TCA ' . $table . '[\'ctrl\'][\'transForeignTable\']'; + } + if (!empty($tableDefinition['ctrl']['transOrigPointerTable'])) { + unset($tableDefinition['ctrl']['transOrigPointerTable']); + $this->messages[] = 'The TCA setting \'transOrigPointerTable\' was removed ' + . 'in TCA ' . $table . '[\'ctrl\'][\'transOrigPointerTable\']'; + } + } + return $tca; + } } diff --git a/typo3/sysext/core/Tests/Unit/Migrations/TcaMigrationTest.php b/typo3/sysext/core/Tests/Unit/Migrations/TcaMigrationTest.php index 44ac22467856..fbdef39885ce 100644 --- a/typo3/sysext/core/Tests/Unit/Migrations/TcaMigrationTest.php +++ b/typo3/sysext/core/Tests/Unit/Migrations/TcaMigrationTest.php @@ -1865,4 +1865,53 @@ class TcaMigrationTest extends UnitTestCase $subject = new TcaMigration(); $this->assertEquals($expectedConfig, $subject->migrate($givenConfig)); } + + /** + * @return array + */ + public function migrateTranslationTableDataProvider() + { + return [ + 'remove transForeignTable' => [ + [ + 'aTable' => [ + 'ctrl' => [ + 'transForeignTable' => 'pages_language_overlay', + ], + ], + ], + [ + 'aTable' => [ + 'ctrl' => [], + ], + ] + ], + 'remove transOrigPointerTable' => [ + [ + 'aTable' => [ + 'ctrl' => [ + 'transOrigPointerTable' => 'pages', + ], + ], + ], + [ + 'aTable' => [ + 'ctrl' => [], + ], + ] + ] + ]; + } + + /** + * @param array $givenConfig + * @param array $expectedConfig + * @test + * @dataProvider migrateTranslationTableDataProvider + */ + public function migrateTranslationTable(array $givenConfig, array $expectedConfig) + { + $subject = new TcaMigration(); + $this->assertEquals($expectedConfig, $subject->migrate($givenConfig)); + } } -- GitLab