90044[TASK] Refactor workspace BE module internals
Commit message
Review
-
Code review CR +2 Done
- Christian Kuhn +2
- Garvin Hicking +1
- Stefan Bürk +1
-
Verified V +2 Done
- Christian Kuhn +2
- Garvin Hicking +1
- Stefan Bürk +1
- core-ci +1 CI
Issues 1
Files 18
- Build/phpstan/phpstan-baseline.neon+0 −6
- typo3/sysext/backend/Classes/Form/FormDataProvider/DatabaseUserPermissionCheck.php+3 −4
- typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php+7 −0
- typo3/sysext/workspaces/Classes/Backend/ToolbarItems/WorkspaceSelectorToolbarItem.php+1 −1
- typo3/sysext/workspaces/Classes/Controller/ReviewController.php6+36 −41
- typo3/sysext/workspaces/Classes/Controller/WorkspacesAjaxController.php+95 −63
- typo3/sysext/workspaces/Classes/Domain/Model/Workspace.phpnew+48 −0
- typo3/sysext/workspaces/Classes/Domain/Model/WorkspaceStage.phpnew+41 −0
- typo3/sysext/workspaces/Classes/Domain/Record/StageRecord.phpdeleted+0 −272
- typo3/sysext/workspaces/Classes/Domain/Record/WorkspaceRecord.phpdeleted+0 −225
- typo3/sysext/workspaces/Classes/Domain/Repository/WorkspaceRepository.php7new+56 −0
- typo3/sysext/workspaces/Classes/Domain/Repository/WorkspaceStageRepository.php3new+155 −0
- typo3/sysext/workspaces/Classes/Exception/AbstractException.phpnew+22 −0
- typo3/sysext/workspaces/Classes/Exception/WorkspaceStageNotFoundException.phpnew+20 −0
- typo3/sysext/workspaces/Classes/Service/GridDataService.php+67 −37
- typo3/sysext/workspaces/Classes/Service/StagesService.php+149 −267
- typo3/sysext/workspaces/Classes/Service/WorkspaceService.php+5 −6
- typo3/sysext/workspaces/Resources/Private/Language/locallang.xlf+2 −7
Review log 5289
Show 3464 earlier messages
-
Christian Kuhn uploaded patch set 1 07/10/25, 10:59
-
core-ci voted on patch set 1 V -1 07/10/25, 11:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81554
-
Christian Kuhn uploaded patch set 2
V -107/10/25, 11:37 -
core-ci voted on patch set 2 V -1 07/10/25, 11:44 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81555
-
Christian Kuhn uploaded patch set 3
V -107/10/25, 11:45 -
core-ci voted on patch set 3 V +1 07/10/25, 11:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81556
-
Christian Kuhn uploaded patch set 4
V +107/10/25, 11:53 -
core-ci voted on patch set 4 V +1 07/10/25, 12:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81557
-
Christian Kuhn uploaded patch set 5
V +107/10/25, 14:32 -
core-ci voted on patch set 5 V +1 07/10/25, 14:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81563
-
Christian Kuhn uploaded patch set 6
V +107/10/25, 15:12 -
core-ci voted on patch set 6 V +1 07/10/25, 15:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81571
-
Christian Kuhn uploaded patch set 7
V +107/10/25, 15:35 -
core-ci voted on patch set 7 V +1 07/10/25, 15:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81572
-
Christian Kuhn uploaded patch set 8
V +107/10/25, 15:51 -
core-ci voted on patch set 8 V +1 07/10/25, 15:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81573
-
Christian Kuhn uploaded patch set 9
V +107/10/25, 16:25 -
core-ci voted on patch set 9 V +1 07/10/25, 16:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81574
-
Christian Kuhn uploaded patch set 10
V +107/10/25, 17:17 -
Christian Kuhn uploaded patch set 11 07/10/25, 17:22
-
core-ci voted on patch set 10 V -1 07/10/25, 17:25 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81575
-
core-ci voted on patch set 11 V -1 07/10/25, 17:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81576
-
Christian Kuhn uploaded patch set 12
V -107/10/25, 17:46 -
core-ci voted on patch set 12 V -1 07/10/25, 17:53 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81577
-
Christian Kuhn uploaded patch set 13
V -107/10/25, 19:11 -
Christian Kuhn uploaded patch set 14 07/10/25, 19:14
-
core-ci voted on patch set 13 V -1 07/10/25, 19:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81578
-
core-ci voted on patch set 14 V -1 07/10/25, 19:22 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81579
-
Christian Kuhn uploaded patch set 15
V -107/10/25, 21:58 -
core-ci voted on patch set 15 V +1 07/10/25, 22:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81580
-
Christian Kuhn uploaded patch set 16
V +107/10/25, 22:06 -
Christian Kuhn uploaded patch set 17 07/10/25, 22:06
-
core-ci voted on patch set 16 V +1 07/10/25, 22:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81581
-
core-ci voted on patch set 17 V +1 07/10/25, 22:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81582
-
Christian Kuhn uploaded patch set 18
V +107/11/25, 00:07 -
Christian Kuhn uploaded patch set 19 07/11/25, 00:10
-
core-ci voted on patch set 18 V +1 07/11/25, 00:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81583
-
core-ci voted on patch set 19 V +1 07/11/25, 00:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81584
-
Benjamin Franzke commented on patch set 19 07/11/25, 05:38
WorkspaceStageRepository.php:61For sake of readability (and performance, but primarly readability) we should use the spread operator instead of `array_merge`: ``` array_unique([ ...$workspaceRecord->editStageDefaultRecipients, ...$workspaceRecord->owners, ...$workspaceRecord->members, ]) ``` https://wiki.php.net/rfc/spread_operator_for_array#advantages_over_array_merge > Spread operator should have a better performance than array_merge. It's because not only that spread operator is a language structure while array_merge is a function call, but also compile time optimization can be performant for constant arrays. -
Christian Kuhn uploaded patch set 20
V +107/12/25, 14:31 -
core-ci voted on patch set 20 V +1 07/12/25, 14:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81633
-
Christian Kuhn uploaded patch set 21
V +107/12/25, 15:40 -
core-ci voted on patch set 21 V +1 07/12/25, 15:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81634
-
Christian Kuhn uploaded patch set 22
V +107/12/25, 16:24 -
core-ci voted on patch set 22 V -1 07/12/25, 16:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81635
-
Christian Kuhn uploaded patch set 23
V -107/12/25, 20:06 -
core-ci voted on patch set 23 V +1 07/12/25, 20:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81637
-
Christian Kuhn uploaded patch set 24
V +107/12/25, 20:15 -
core-ci voted on patch set 24 V +1 07/12/25, 20:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81638
-
Christian Kuhn uploaded patch set 25
V +107/12/25, 23:45 -
core-ci voted on patch set 25 V +1 07/12/25, 23:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81639
-
Christian Kuhn uploaded patch set 26
V +107/13/25, 00:23 -
core-ci voted on patch set 26 V +1 07/13/25, 00:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81640
-
Christian Kuhn uploaded patch set 27
V +107/13/25, 00:58 -
Christian Kuhn uploaded patch set 28 07/13/25, 00:59
-
core-ci voted on patch set 27 V +1 07/13/25, 01:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81641
-
core-ci voted on patch set 28 V +1 07/13/25, 01:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81642
-
Christian Kuhn uploaded patch set 29
V +107/13/25, 01:10 -
core-ci voted on patch set 29 V +1 07/13/25, 01:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81644
-
Benjamin Franzke commented on patch set 29 07/14/25, 13:59
WorkspaceRepository.php:45I think a repository should not perform view-related permission checks. By applying these checks here, `TYPO3\CMS\Workspaces\Domain\Model\Workspace` is not an actualy record representation (as the class documentation states), but effectively a view and (user-)context specific data transfer object (DTO). These kind transformations needs to be invoked by the controller, the repository should only deliver data, no evaluation/mapping to user-specific details. -
Christian Kuhn rebased onto patch set 30
V +108/14/25, 12:52 -
core-ci voted on patch set 30 V +1 08/14/25, 12:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83390
-
Christian Kuhn commented on patch set 30 08/14/25, 13:15
WorkspaceRepository.php:45ReplyYeah. The model class comment is still wrong and i'll update it: The models are DO's derived from db records and current be-user. The stage records additionally represent a merge of data coming from the upper workspace record. These DO's are tailored to be used in the be module controllers, related services and view. I don't think 'repository' is plain wrong, but arguable: We kinda think of repositories returning plain db objects, but that's imho not necessarily the case. I think its fine when they prepare DO's in a way they are easily consumable within their application domain, which is what the two repositories do now. I'll have another refactoring loop to further simplify these DO's, which will reduce DB load, too (the group resolving stuff is expensive and we don't need the detail distinctions). Note the main goal of the patch is to disentangle the current mess with four classes depending on each other, all sharing state. I'll document that in the commit message after finishing last details. If we really want to rename or move parts later, we can do this quite easily since the patch reduces the complexity so much that large parts of the code base become close to trivial, plus the entire stuff is internal, giving us room for such stuff. I tend to keep the current strategy, but I'll have a look if stuff like accessing translations in the repository classes could be relocated elsewhere easily without making much bigger at this point.WorkspaceRepository.php:48Replyyeah. will do. this area will receive further love with upcoming patch sets since we don't need the details anyway and can combine this with a reduction of db queries.WorkspaceStageRepository.php:61Replyack. will do. -
Christian Kuhn commented on patch set 30 08/14/25, 13:28
WorkspaceRepository.php:45ReplyNote we very well *can* split the two repository classes into a 'repository' class that does the db call (which is a BU::getRecord() one-liner in one case, plus a trivial query in the other case), that return the db array, plus a service that creates the objects from it and incorporates the 'preparation' that is consumed in the various places. We'll then end up with two basically one-liner repo-classes, which is why i didn't took this path - it felt like too much abstraction and we'd have to move the db-arrays around again, which doesn't improve anything. I suggest to see what can be simplified in the current models in another round of this patch, and then we decide if we split that stuff again, or keep it.
-
Christian Kuhn uploaded patch set 31
V +108/19/25, 11:02 -
core-ci voted on patch set 31 V +1 08/19/25, 11:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83608
-
Christian Kuhn uploaded patch set 32
V +108/19/25, 13:55 -
Christian Kuhn commented on patch set 31 08/19/25, 13:56
WorkspaceStageRepository.php:61ReplyDone -
core-ci voted on patch set 32 V -1 08/19/25, 14:03 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83609
-
Christian Kuhn uploaded patch set 33
V -108/19/25, 14:21 -
core-ci voted on patch set 33 V +1 08/19/25, 14:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83613
-
Christian Kuhn uploaded patch set 34
V +108/19/25, 15:27 -
Christian Kuhn commented on patch set 33 08/19/25, 15:28
WorkspaceRepository.php:45Replyi updated the model class comments and will keep the strategy for now.WorkspaceRepository.php:48ReplyDone -
core-ci voted on patch set 34 V +1 08/19/25, 15:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83617
-
Christian Kuhn uploaded patch set 35
V +108/19/25, 15:44 -
core-ci voted on patch set 35 V +1 08/19/25, 15:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83618
-
Christian Kuhn updated the commit message in patch set 36
V +108/19/25, 16:07 -
core-ci voted on patch set 36 V +1 08/19/25, 16:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83620
-
Stefan Bürk commented on patch set 36 CR -1 08/20/25, 06:24
Reviewing ... -
Stefan Bürk commented on patch set 36 CR 0 08/20/25, 06:58
ReviewController.php:238You use `array_pop()` as replacement for the original array_filter to get rid of the `publishing stage (-20)`, right ? If yes, can we be sure that it is always the last array item ? I think that is kind of unsafe. I would prefer to get rid of the array_pop in that case and adding a `if() {continue;}` to the foreach loop in that case, which feels kind of safer. What do you think ?ReviewController.php:250```suggestion foreach ($stages as $stage) { if ($stage->uid === StagesService::STAGE_PUBLISH_EXECUTE_ID) { // Removes the publishing stage (-20) by skipping it. continue; } $selectStages[] = [ 'uid' => $stage->uid, 'label' => $stage->title, ]; } ``` See above .. I would prefere this over the `array_pop()` to have a safe method to get rid of the explicitly stage (-20) which should be removed. What do you think ? -
Christian Kuhn commented on patch set 36 08/20/25, 09:49
ReviewController.php:238Replyi relied on the fact that the 'pseudo' execute stage (which is an ugly artefact on its own, but that's a change for later) is *always there* and *always the last one*. for now, the change would be 'safe enough' but we could also change the code a bit.ReviewController.php:250Replyi wanted to get rid of that constant usage since i think it has to fall at some point. but we can change it, i don't care *that* much at the moment. -
Christian Kuhn commented on patch set 36 08/20/25, 11:59
ReviewController.php:238ReplyDoneReviewController.php:250Replyactually, rereading the surrounding code ... your solution is more safe, stefan. adapted. -
Christian Kuhn commented on patch set 36 08/20/25, 12:00
Reply
Done -
Christian Kuhn uploaded patch set 37
V +108/20/25, 12:00 -
core-ci voted on patch set 37 V +1 08/20/25, 12:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83668
-
Stefan Bürk voted on patch set 37 CR +1 V +1 08/20/25, 12:17
-
Garvin Hicking voted on patch set 37 CR +1 V +1 08/20/25, 12:45
-
Christian Kuhn voted on patch set 37 CR +2 V +2 08/20/25, 13:23
-
Christian Kuhn merged patch set 38 08/20/25, 13:23
WorkspaceRepository.php:48