diff --git a/typo3/sysext/form/Classes/Domain/Finishers/SaveToDatabaseFinisher.php b/typo3/sysext/form/Classes/Domain/Finishers/SaveToDatabaseFinisher.php index cf63b4d9ac9e66bbcf9f3bd7c770d41c0503a7d3..33747bf60bbcad027af2e7308a812651a8bb60f3 100644 --- a/typo3/sysext/form/Classes/Domain/Finishers/SaveToDatabaseFinisher.php +++ b/typo3/sysext/form/Classes/Domain/Finishers/SaveToDatabaseFinisher.php @@ -308,8 +308,8 @@ class SaveToDatabaseFinisher extends AbstractFinisher protected function saveToDatabase(array $databaseData, string $table, int $iterationCount) { if (!empty($databaseData)) { - if ($this->options['mode'] === 'update') { - $whereClause = $this->options['whereClause']; + if ($this->parseOption('mode') === 'update') { + $whereClause = $this->parseOption('whereClause'); foreach ($whereClause as $columnName => $columnValue) { $whereClause[$columnName] = $this->parseOption('whereClause.' . $columnName); } @@ -339,8 +339,8 @@ class SaveToDatabaseFinisher extends AbstractFinisher protected function throwExceptionOnInconsistentConfiguration() { if ( - $this->options['mode'] === 'update' - && empty($this->options['whereClause']) + $this->parseOption('mode') === 'update' + && empty($this->parseOption('whereClause')) ) { throw new FinisherException( 'An empty option "whereClause" is not allowed in update mode.', diff --git a/typo3/sysext/form/Tests/Unit/Domain/Finishers/SaveToDatabaseFinisherTest.php b/typo3/sysext/form/Tests/Unit/Domain/Finishers/SaveToDatabaseFinisherTest.php index baffdc5ce15f2d3b22bb8ca9bffc0c742b952ef8..e57c1ac151cc0affd55127a9f2e630eea926d681 100644 --- a/typo3/sysext/form/Tests/Unit/Domain/Finishers/SaveToDatabaseFinisherTest.php +++ b/typo3/sysext/form/Tests/Unit/Domain/Finishers/SaveToDatabaseFinisherTest.php @@ -36,14 +36,10 @@ class SaveToDatabaseFinisherTest extends UnitTestCase { $this->expectException(FinisherException::class); $this->expectExceptionCode(1480469086); - - $mockSaveToDatabaseFinisher = $this->getAccessibleMock(SaveToDatabaseFinisher::class, [ - 'dummy', - ], [], '', false); - - $mockSaveToDatabaseFinisher->_set('options', [ - 'mode' => 'update', - 'whereClause' => '', + $mockSaveToDatabaseFinisher = $this->getAccessibleMock(SaveToDatabaseFinisher::class, ['parseOption'], [], '', false); + $mockSaveToDatabaseFinisher->method('parseOption')->willReturnMap([ + ['mode', 'update'], + ['whereClause', ''], ]); $mockSaveToDatabaseFinisher->_call('throwExceptionOnInconsistentConfiguration');