Review main Merged

88115[TASK] Streamline DataHandler->process_datamap() #2

Christian Kuhn CR +2 V +2 Normal +88 −117 updated 02/10/25, 14:55

Commit message

This is a classic "divide & conquer" change in process_datamap().
The main foreach() in process_datamap() is constructed like this:

if (this is a new record) {
  $status = 'new';
  ...
} else {
  $status = 'update';
  ...
}
if ($status = "new") {
  ...
) else {
  ...
}

The patch inlines "all work for new" to the "new" branch, and
"all work for update" to the "update" branch.

This allows looking and optimizing single code branches without
much code duplication.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Andreas Nedbal +1
    • Stefan Bürk +1
    • Andreas Wolf +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Andreas Nedbal +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 2

Files 1

Review log 1520

  1. Christian Kuhn uploaded patch set 1 02/09/25, 17:18

  2. core-ci voted on patch set 1 V -1 02/09/25, 17:24 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73844

  3. core-ci voted on patch set 1 V +1 02/09/25, 17:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73844

  4. Christian Kuhn updated the commit message in patch set 2 V +1 02/09/25, 17:31

  5. core-ci voted on patch set 2 V +1 02/09/25, 17:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73845

  6. Christian Kuhn updated the commit message in patch set 3 V +1 02/09/25, 17:47

  7. core-ci voted on patch set 3 V +1 02/09/25, 18:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73850

  8. Stefan Bürk voted on patch set 3 CR +1 V +1 02/09/25, 19:08

  9. Christian Kuhn voted on patch set 3 CR -1 02/09/25, 20:28

  10. Christian Kuhn commented on patch set 3 02/09/25, 21:00

    got feedback from andy wolf the handing of $old_pid_value may be broken now.
  11. Andreas Wolf commented on patch set 3 02/09/25, 21:11

    DataHandler.php:966

    I think the third parameter should be "$fieldArray['pid'] ?? 0", since it used to be "$old_pid_value ?: ($fieldArray['pid'] ?? 0)" and $old_pid_value was '' before.
  12. Christian Kuhn uploaded patch set 4 CR +1 V +1 02/10/25, 10:35

  13. Christian Kuhn commented on patch set 4 02/10/25, 10:37

    DataHandler.php:966 Reply

    phpstan: "Offset 'pid' on array{} on left side of ?? does not exist." $fieldArray is initialized to an empty array in else "update" branch. We should input int 0.
  14. core-ci voted on patch set 4 V +1 02/10/25, 10:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73884

  15. Stefan Bürk voted on patch set 4 CR +1 02/10/25, 12:26

  16. Andreas Nedbal voted on patch set 4 CR +1 V +1 02/10/25, 13:12

  17. Stefan Bürk voted on patch set 4 V +1 02/10/25, 13:29

  18. Andreas Wolf voted on patch set 4 CR +1 02/10/25, 14:29

  19. Christian Kuhn voted on patch set 4 CR +2 V +2 02/10/25, 14:55

  20. Christian Kuhn merged patch set 5 02/10/25, 14:55