Review main Merged

83839[BUGFIX] Allow persisting nullable properties in extbase

Torben Hansen CR +2 V +2 Normal +172 −15 updated 05/07/24, 05:32

Commit message

Extbase persistence does not treat nullable properties like
DataHandler does. A nullable domain model property, which
either implements `DomainObjectInterface` or is of type
`DateTime`, can not be set to null again, when the object is
already persisted with a value not equal to null.

DataHandler respects this scenario by using the value of the
`default` config TCA key for affected relation fields or by
typecasting an empty value to integer for `datetime` fields.
For `datetime` fields, additionally the `dbType` is evaluated
and an empty value is transformed to the corresponding
dbType empty value.

This change covers both scenarios in extbase persistence,
so it is possible to set properties to `null`, if the
property either implements `DomainObjectInterface` or
is of type `DateTime`.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 2

Files 8

Review log 2532

Show 57 earlier messages
  1. Torben Hansen uploaded patch set 1 04/16/24, 17:21

  2. Torben Hansen updated the commit message in patch set 2 04/16/24, 17:21

  3. core-ci voted on patch set 1 V +1 04/16/24, 17:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56097

  4. core-ci voted on patch set 2 V +1 04/16/24, 17:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56098

  5. Oliver Klee commented on patch set 2 04/16/24, 20:37

    If this is a bugfix, would it make sense to backport it to 12.4?
  6. Mathias Brodala commented on patch set 2 CR -1 04/17/24, 06:22

    Backend.php:944

    We should be careful here to not change the existing method signature. Instead the property should be the 3rd argument. You can use named parameters here to skip the $columnMap if not necessary.

    Backend.php:950

    Instead of adjusting a variable you should use early returns everywhere. This also makes the code easier to understand.

    Backend.php:959

    This must be a \DateTimeInterface check instead, otherwise subclasses and \DateTimeImmutable are not covered.
  7. Torben Hansen uploaded patch set 3 CR -1 V +1 04/17/24, 17:01

  1. Torben Hansen commented on patch set 2 04/17/24, 17:01

    Reply

    Basically yes, but I would prefer not to change this in v12 to reduce the risk of unwanted side-effects with the patch.

    Backend.php:944 Reply

    Done

    Backend.php:950 Reply

    Done

    Backend.php:959 Reply

    Done
  2. core-ci voted on patch set 3 V +1 04/17/24, 17:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56186

  3. Torben Hansen updated the commit message in patch set 4 V +1 04/17/24, 17:09

  4. core-ci voted on patch set 4 V +1 04/17/24, 17:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56187

  5. Oliver Klee commented on patch set 4 04/17/24, 17:16

    Reply

    Ack.
  6. Oliver Klee commented on patch set 4 04/17/24, 17:17

    UpdateTest.php:40

    These can all be private.
  7. Mathias Brodala voted on patch set 4 CR +1 04/18/24, 05:22

  8. Georg Ringer voted on patch set 4 CR +1 V +1 04/18/24, 05:31

  9. Stefan Bürk commented on patch set 4 CR -1 04/18/24, 13:21

  10. Stefan Bürk commented on patch set 4 04/18/24, 13:29

    UpdateTest.php:73

    We usually use `$this->assertCSVDataSet()` for database record assertion in various places, and I would stay away from direct retrievements using querybuilder records that way.

    UpdateTest.php:102

    We usually use `$this->assertCSVDataSet()` for database record assertion in various places, and I would stay away from direct retrievements using querybuilder records that way.
  11. Torben Hansen uploaded patch set 5 CR +1 V +1 04/18/24, 15:23

  12. Torben Hansen commented on patch set 4 04/18/24, 15:23

    Backend.php:324 Reply

    Done

    UpdateTest.php:40 Reply

    Done

    UpdateTest.php:73 Reply

    Done
  13. core-ci voted on patch set 5 V +1 04/18/24, 15:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56268

  14. Oliver Klee voted on patch set 5 V +1 04/18/24, 15:38

  15. Oliver Klee commented on patch set 5 04/19/24, 17:04

    UpdateTest.php:102 Reply

    Done
  16. Torben Hansen commented on patch set 5 04/19/24, 17:10

    Reply

    Done
  17. Torben Hansen rebased onto patch set 6 V +1 04/22/24, 12:01

  18. core-ci voted on patch set 6 V +1 04/22/24, 12:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56487

  19. Oliver Klee voted on patch set 6 V +1 04/22/24, 12:45

  20. Torben Hansen rebased onto patch set 7 V +1 04/27/24, 11:26

  21. Oliver Klee voted on patch set 7 V +1 04/27/24, 11:28

  22. core-ci voted on patch set 7 V +1 04/27/24, 11:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56847

  23. Simon Schaufelberger voted on patch set 7 CR +1 V +1 04/29/24, 09:25

  24. Benni Mack voted on patch set 7 CR +2 V +2 05/07/24, 05:32

  25. Benni Mack merged patch set 8 05/07/24, 05:32