Review main Merged

80099[FEATURE] Let Extbase handle native enums

Alexander Schnitzler CR +2 V +2 Hard +269 −8 updated 07/26/23, 13:15

Commit message

With PHP 8.1, native support for enums has been introduced.
This is quite handy if a database field has a specific set
of values which can be represented by a PHP enum.

Extbase does now support using native enums as entity
properties.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
    • Benni Mack +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 15

Review log 2938

Show 913 earlier messages
  1. Alexander Schnitzler uploaded patch set 1 07/20/23, 08:04

  2. Alexander Schnitzler wrote 07/20/23, 08:05

    Topic set to extbase
  3. core-ci voted on patch set 1 V -1 07/20/23, 08:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44332

  4. Alexander Schnitzler uploaded patch set 2 V -1 07/20/23, 10:27

  5. Alexander Schnitzler marked it ready for review 07/20/23, 10:27

  6. Oliver Klee updated the commit message in patch set 3 07/20/23, 10:30

  7. Oliver Klee commented on patch set 3 07/20/23, 10:32

    AbstractDomainObject.php:203

    Shorter: `!($propertyValue instanceof \UnitEnum)`

    DataMapper.php:266

    Any reason to not use `instanceof` here?
  8. core-ci voted on patch set 2 V +1 07/20/23, 10:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44338

  9. core-ci voted on patch set 3 V +1 07/20/23, 10:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44339

  10. Alexander Schnitzler commented on patch set 3 07/20/23, 10:42

    AbstractDomainObject.php:203 Reply

    Yes, shorter but less readable IMHO because it is combined with another condition. I like `!` but in this case I think comparing with `false` is easier to understand. However, I am not against using `!` here. If we want it shorter, it's fine for me.

    DataMapper.php:266 Reply

    Yes, we are in the process of creating the value here. So we don't have an object already, all we have is the type and we need to create the object(enum) in question. That's why we can't use instanceof. `$propertyType` is a FQCN here.
  11. Oliver Klee commented on patch set 4 V +1 07/20/23, 10:44

    Published edit on patch set 3.
  12. Oliver Klee commented on patch set 4 V +1 CR +1 07/20/23, 10:44

    AbstractDomainObject.php:203 Reply

    Done

    DataMapper.php:266 Reply

    Ack
  13. core-ci voted on patch set 4 V +1 07/20/23, 10:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44340

  1. Alexander Schnitzler commented on patch set 4 V -1 07/20/23, 11:12

    I thought about this for a while and I think we need tests here for saving an entity with enum to the database. That's currently not handled at all.
  2. Alexander Schnitzler uploaded patch set 5 CR +1 V +1 07/20/23, 12:36

  3. Oliver Klee voted on patch set 5 V +1 CR +1 07/20/23, 12:41

  4. core-ci voted on patch set 5 V -1 07/20/23, 12:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44344

  5. Oliver Klee voted on patch set 5 CR 0 07/20/23, 13:06

  6. Alexander Schnitzler uploaded patch set 6 V +1 07/20/23, 13:16

  7. core-ci voted on patch set 6 V +1 07/20/23, 13:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44345

  8. Oliver Klee commented on patch set 7 V +1 07/20/23, 13:33

    Published edit on patch set 6.
  9. Oliver Klee voted on patch set 7 V +1 CR +1 07/20/23, 13:33

  10. core-ci voted on patch set 7 V +1 07/20/23, 13:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44346

  11. Alexander Schnitzler uploaded patch set 8 CR +1 V +1 07/24/23, 06:43

  12. core-ci voted on patch set 8 V -1 07/24/23, 06:55 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44453

  13. Oliver Klee commented on patch set 8 07/24/23, 20:17

    This change probably will allow https://review.typo3.org/c/Packages/TYPO3.CMS/+/79513 to continue. Is there any way others can help with this change here?
  14. Alexander Schnitzler commented on patch set 8 07/25/23, 05:40

    Reply

    No, nothing to help with at the moment. I will take care during the week.
  15. Alexander Schnitzler uploaded patch set 9 V -1 07/25/23, 05:55

  16. core-ci voted on patch set 9 V +1 07/25/23, 06:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44492

  17. Alexander Schnitzler marked it ready for review 07/25/23, 06:03

  18. Alexander Schnitzler commented on patch set 9 07/25/23, 06:04

    DataMapper.php:267

    Having that many method params isn't ideal but we can work on that later.
  19. Benni Mack voted on patch set 9 V +1 CR +1 07/25/23, 06:22

  20. Oliver Klee voted on patch set 9 V +1 07/25/23, 07:44

  21. Oliver Klee voted on patch set 9 CR +1 07/25/23, 07:45

  22. Stefan Bürk commented on patch set 9 V +1 07/25/23, 20:15

    Feature-101396-LetExtbaseHandleNativeEnums.rst:16

    Should we somehow emphasize that only BackedEnums are supported ? as a note block/info block ?
  23. Alexander Schnitzler commented on patch set 9 07/26/23, 12:46

    Feature-101396-LetExtbaseHandleNativeEnums.rst:16 Reply

    I wonder how people might think regular enums are implemented if we store a value in the database but we don't have a value in the php implementation. Maybe if people confuse cases with values? I am not against it but I don't see a need to be honest. Maybe I lack some knowledge or imagination here though.
  24. Stefan Bürk commented on patch set 9 V +2 CR +2 07/26/23, 13:15

    Feature-101396-LetExtbaseHandleNativeEnums.rst:16 Reply

    We will add it when the first question rises in the cms channel or on slack than.
  25. Stefan Bürk merged patch set 10 07/26/23, 13:15