Review main Abandoned

78235[TASK] Introduce DatabaseType enum

Alexander Schnitzler CR 0 V 0 Hard +176 −123 updated 04/01/23, 17:12

Commit message

This change introduces enum DatabaseType which represents
all possible values to be used for TCA field dbType.

Example:

$GLOBALS['TCA']['table'] = [
    // ...
    'columns' => [
        'column' => [
            'config' => [
                // ...
               'dbType' = 'date';
             ]
        ]
    ]
];

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 23

Show 3 more files

Review log 3442

Show 1017 earlier messages
  1. Alexander Schnitzler uploaded patch set 1 03/23/23, 17:58

  2. Alexander Schnitzler commented on patch set 1 03/23/23, 18:05

    DataMapper.php:318

    This is wrong, on it.

    DatabaseIntegrityController.php:897

    This is unintentionally added by php-cs-fixer.

    DatabaseIntegrityController.php:2231

    This is unintentionally added by php-cs-fixer.
  3. core-ci voted on patch set 1 V -1 03/23/23, 18:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39487

  4. Alexander Schnitzler uploaded patch set 2 V -1 03/23/23, 18:20

  5. Alexander Schnitzler uploaded patch set 3 03/23/23, 18:41

  6. core-ci voted on patch set 2 V -1 03/23/23, 18:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39490

  7. Alexander Schnitzler updated the commit message in patch set 4 03/23/23, 19:00

  8. Alexander Schnitzler commented on patch set 4 03/23/23, 19:00

    This change is ready for review.

    DataMapper.php:318 Reply

    Done
  9. core-ci voted on patch set 3 V -1 03/23/23, 19:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39491

  10. Alexander Schnitzler uploaded patch set 5 03/23/23, 19:15

  11. core-ci voted on patch set 4 V -1 03/23/23, 19:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39492

  12. core-ci voted on patch set 5 V +1 03/23/23, 19:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39493

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

  14. Alexander Schnitzler commented on patch set 6 03/24/23, 07:10

    DatabaseIntegrityController.php:897 Reply

    Done

    DatabaseIntegrityController.php:2231 Reply

    Done
  15. Alexander Schnitzler uploaded patch set 7 03/24/23, 07:17

  16. core-ci voted on patch set 6 V +1 03/24/23, 07:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39518

  17. core-ci voted on patch set 7 V +1 03/24/23, 07:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39520

  1. Stefan Froemken commented on patch set 7 03/27/23, 16:24

    DatabaseType.php:36

    What about just: return array_column(self::cases(), 'value'); instead of array_map and array function?
  2. Stefan Froemken commented on patch set 7 03/27/23, 16:25

    DatabaseType.php:36 Reply

    ups arrow function
  3. Oliver Klee commented on patch set 7 CR +1 03/27/23, 16:36

    Beautiful!
  4. Stefan Froemken commented on patch set 7 CR -1 03/27/23, 16:45

    TcaMigration.php:890

    Can we use DatabaseType::getDateTimeTypes(); here?
  5. Alexander Schnitzler commented on patch set 7 03/27/23, 16:54

    DatabaseType.php:36 Reply

    I'm not sure array_column works here because we don't have an array of arrays where we can use one column from. We have an array of objects. Maybe I'm mistaken though. Can you please check again?

    TcaMigration.php:890 Reply

    Unfortunately not, date time types is different from date time formats.
  6. Stefan Froemken commented on patch set 7 03/27/23, 17:01

    DatabaseType.php:36 Reply

    Result is exactly the same. I have copied that snippet from a community entry of the php docs ;-)

    TcaMigration.php:890 Reply

    Ups. yes of cause. Sorry.
  7. Oliver Klee commented on patch set 7 03/27/23, 17:08

    TcaMigration.php:890 Reply

    Ack
  8. Stefan Froemken uploaded patch set 8 CR +1 V +1 03/27/23, 18:21

  9. Stefan Froemken voted on patch set 8 V +1 CR +1 03/27/23, 18:23

  10. core-ci voted on patch set 8 V +1 03/27/23, 18:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39716

  11. Wouter Wolters voted on patch set 8 V +1 CR +1 03/27/23, 18:32

  12. Wouter Wolters voted on patch set 8 V 0 03/27/23, 18:32

  13. Oliver Klee voted on patch set 8 CR +1 03/27/23, 19:49

  14. Alexander Schnitzler commented on patch set 8 03/28/23, 16:49

    DatabaseType.php:36 Reply

    Resolved, right?
  15. Oliver Klee voted on patch set 8 V +1 03/29/23, 08:35

  16. Christian Kuhn commented on patch set 8 03/29/23, 09:21

    QueryHelper.php:211

    why not deprecate now?
  17. Benni Mack commented on patch set 8 CR -1 03/29/23, 09:31

    I think we're lacking the other DB Types which TYPO3 supports (JSON and UUID), right?
  18. Alexander Schnitzler commented on patch set 8 03/29/23, 09:44

    Reply

    No, those are actual types. See \TYPO3\CMS\Core\DataHandling\TableColumnType::JSON and \TYPO3\CMS\Core\DataHandling\TableColumnType::UUID. json used to be a dbType, but was converted to an actual type here: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77798

    QueryHelper.php:211 Reply

    My last information was not to deprecate that short before the LTS releases. Maybe things changed but I was once told only to deprecate things in the n.0 release.
  19. Benni Mack commented on patch set 8 03/29/23, 11:28

    QueryHelper.php:211 Reply Unresolved

    This was related to all findBy() methods in all extbase extensions, which I found highly critical to have all currently compatible v12 extensions having trigger_errors() for a long time. This is like deprecating GeneralUtility::makeInstance() NOW. So, there is no rule to not deprecate something before LTS, however, I try to estimate the amount of usages based on various extension scanners and conversations with developers from agencies when to avoid an immediate deprecation.
  20. Benni Mack commented on patch set 8 03/29/23, 11:28

    Reply

    yes. thanks.
  21. Alexander Schnitzler commented on patch set 8 03/29/23, 18:32

    Reply

    Can you remove your -1 on this and let Christian decide to add one again in case we want to handle the deprecation?
  22. Benni Mack voted on patch set 8 CR 0 03/29/23, 21:27

  23. Oliver Hader commented on patch set 8 04/01/23, 16:35

    DatabaseType.php:36 Unresolved

    Using string values here instead of a list of all cases, is reducing the benefits of using enums...

    DatabaseType.php:39 Unresolved

    Hm, all `DatabaseType` values seem to be date-time types... I guess there might be additional types in the future. However, this could be simplified like e.g. ``` $type = DatabaseType::tryFrom($whatever); if ($type instanceof DatabaseType) {} // or if ($type?->isDateTimeType()) {} ```
  24. Oliver Hader voted on patch set 8 CR -1 04/01/23, 16:36

  25. Alexander Schnitzler abandoned the change 04/01/23, 17:12