93040[BUGFIX] Allow persistence to non-uid tables in SaveToDatabaseFinisher
Commit message
Review
-
Code review CR +2 Done
- Garvin Hicking +2
- Oliver Klee +1
- Anja Leichsenring +1
- Josua Vogel +1
-
Verified V +2 Done
- Garvin Hicking +2
- Oliver Klee +1
- Anja Leichsenring +1
- Josua Vogel +1
- core-ci +1 CI
Issues 1
Files 2
Review log 2328
Show 23 earlier messages
-
Garvin Hicking uploaded patch set 1 03/03/26, 08:10
-
core-ci voted on patch set 1 V -1 03/03/26, 08:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97156
-
Garvin Hicking commented on patch set 2
V -103/03/26, 08:39Published edit on patch set 1.
-
Oliver Klee voted on patch set 2 CR +1 V +1 03/03/26, 08:43
-
core-ci voted on patch set 2 V +1 03/03/26, 08:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97159
-
Josua Vogel commented on patch set 2 03/03/26, 11:28
SaveToDatabaseFinisher.php:345the changelog says: "Instead of returning an empty value, Connection::lastInsertId() throws an exception when there's no identity value." Could it be a good idea to set an empty value here instead of 0? -
Christian Kuhn commented on patch set 2 03/03/26, 11:35
SaveToDatabaseFinisherTest.php:30this is default. -
Josua Vogel commented on patch set 2 CR -1 03/03/26, 11:48
I think we can improve the test. I´ll have a look -
Josua Vogel uploaded patch set 3
CR +1V +103/03/26, 11:58 -
Josua Vogel commented on patch set 3 03/03/26, 11:58
SaveToDatabaseFinisherTest.php:30ReplyDone -
Josua Vogel commented on patch set 3 03/03/26, 12:08
SaveToDatabaseFinisher.php:345Replymaybe we should use getFinisherVariableProvider()->add() only, if a lastInsertId is available and add a debug or info log inside the catch ("row inserted, but no uid...") -
core-ci voted on patch set 3 V +1 03/03/26, 12:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97175
-
Garvin Hicking commented on patch set 3 03/03/26, 16:02
thanks for the test update, that broader test will surely help in the futureSaveToDatabaseFinisher.php:345ReplyI'm happy for suggestions. I don't think the value will ever be evaluated inside a finisher. -
Garvin Hicking commented on patch set 3 03/03/26, 21:47
SaveToDatabaseFinisher.php:345ReplyAfter thinking a bit on this I would say: - we should not "skip" setting an iterationCount variable, to not mess with missing lookup variables? - uid=0 should ideally not trigger any "if $insertedUids.XX" statements to be true, and provide least side effects - I don't think we should add a debug or info log, as this would unnecessarily spam the database. If developers store to a database table, they should be aware of this. As of now the bug is blocking insertions though Would you be fine with that? -
Josua Vogel commented on patch set 3 CR +1 V +1 03/04/26, 05:48
SaveToDatabaseFinisher.php:345ReplyYes, good points. I‘m fine with this -
Elias Häußler commented on patch set 3 03/04/26, 07:02
I wonder if this works as expected. When adding these assertions to the test case, the second assertion fails because the actual value is `0` where I'd have expected it to be `0`: ``` self::assertTrue($finisherContext->getFinisherVariableProvider()->exists('SaveToDatabase', 'insertedUids.0')); self::assertSame(0, $finisherContext->getFinisherVariableProvider()->get('SaveToDatabase', 'insertedUids.0')); ``` -
Elias Häußler commented on patch set 3 03/04/26, 07:03
Reply
Sorry, the actual value is `1` and not `0`, but the expectation is `0`. -
Elias Häußler commented on patch set 3 03/04/26, 07:43
Reply
My fault, I wasn't aware that SQLite behaves differently than other DBMSs like MySQL (thanks @garvin@hick.ing!). The following works with my assertion: ``` Build/Scripts/runTests.sh -s functional -d mysql -- --filter insertIntoTableWithoutUidColumnCreatesRow ``` I'd still like to have these assertions in place, since I consider them relevant for the actual test. Something like this should work across all available DBMSs: ``` $databasePlatform = $this->getConnectionPool()->getConnectionForTable('sys_category_record_mm')->getDatabasePlatform(); // These assertions only work for non-SQLite DBMSs since SQLite returns an unexpected value for lastInsertId if (!$databasePlatform instanceof SQLitePlatform) { self::assertTrue($finisherContext->getFinisherVariableProvider()->exists('SaveToDatabase', 'insertedUids.0')); self::assertSame(0, $finisherContext->getFinisherVariableProvider()->get('SaveToDatabase', 'insertedUids.0')); } ``` -
Elias Häußler uploaded patch set 4
CR +1V +103/04/26, 08:37 -
Elias Häußler commented on patch set 4 03/04/26, 08:37
Reply
Done -
Oliver Klee voted on patch set 4 CR +1 V +1 03/04/26, 08:38
-
Garvin Hicking commented on patch set 4 03/04/26, 08:41
Reply
Thank you! That's very helpful to assert, agreed. Cool you took care of it. -
core-ci voted on patch set 4 V -1 03/04/26, 08:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97273
-
core-ci voted on patch set 4 V +1 03/04/26, 10:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97273
-
Josua Vogel voted on patch set 4 CR +1 V +1 03/04/26, 10:16
-
Anja Leichsenring voted on patch set 4 CR +1 V +1 03/04/26, 12:54
-
Garvin Hicking voted on patch set 4 CR +2 V +2 03/04/26, 13:04
-
Garvin Hicking merged patch set 5 03/04/26, 13:56