Review main Merged

93623[TASK] Make DomainObjectInterface non-internal

Oliver Klee CR +2 V +2 Easy +13 −3 updated 04/16/26, 16:38

Commit message

This is part of allowing extensions to use `getUid()`,
`getPid()` and `setPid()` without triggering static code
analysis warnings about using internal API.

Making the actual method implemenations non-internal will
come in a later change.

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Benjamin Franzke +1
    • Markus Klein +1
    • Torben Hansen +1
    • Stefan Bürk +1
    • Sebastian Iffland +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Benjamin Franzke +1
    • Markus Klein +1
    • Torben Hansen +1
    • Stefan Bürk +1
    • Sebastian Iffland +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 2

Files 1

Review log 1820

  1. Oliver Klee uploaded patch set 1 04/11/26, 10:26

  2. core-ci voted on patch set 1 V +1 04/11/26, 10:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99958

  3. Sebastian Iffland commented on patch set 1 CR +1 V +1 04/13/26, 05:44

    LGTM! One curiosity in wording in class description, off topic: `Usually you will need to subclass \TYPO3\CMS\Extbase\DomainObject\AbstractEntity and \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject instead.` -> Don't really get the point, 'instead of' what? This made it in [6.2.0](https://github.com/TYPO3/typo3/commit/eb8d7696bd276013cb2c73e6265b5a2590711e35), so pretty ancient.
  4. Oliver Klee commented on patch set 1 04/14/26, 14:57

  5. Oliver Klee wrote 04/14/26, 14:58

    Topic set to extbase
  6. Oliver Klee rebased onto patch set 2 CR +1 V +1 04/14/26, 19:44

  7. core-ci voted on patch set 2 V +1 04/14/26, 19:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100197

  8. Garvin Hicking voted on patch set 2 CR +1 V +1 04/14/26, 20:00

  9. Markus Klein voted on patch set 2 CR +1 V +1 04/16/26, 10:02

  10. Torben Hansen voted on patch set 2 CR +1 V +1 04/16/26, 10:19

  11. Sebastian Iffland voted on patch set 2 CR +1 V +1 04/16/26, 10:21

  12. Stefan Bürk voted on patch set 2 CR +1 V +1 04/16/26, 11:30

  13. Christian Kuhn voted on patch set 2 CR +1 V +1 04/16/26, 11:52

  14. Garvin Hicking commented on patch set 2 CR -1 04/16/26, 13:36

    Unresolved

    We'll merge very likely this, but will also have a look at the followup goal first. Temporary block only.
  15. Oliver Klee commented on patch set 2 04/16/26, 14:25

  16. Oliver Klee commented on patch set 2 04/16/26, 14:51

    There are two possible paths forward after this: a) make AbstractDomainObject non-internal (and make only some methods internal: https://review.typo3.org/c/Packages/TYPO3.CMS/+/92998 b) pull down the UID and PID setters to AbstractEntity and AbstractValueObject: https://review.typo3.org/c/Packages/TYPO3.CMS/+/93693
  17. Benjamin Franzke voted on patch set 2 CR +1 V +1 04/16/26, 16:22

  18. Garvin Hicking commented on patch set 2 CR +2 V +2 04/16/26, 16:27

    This one is undisputed by everyone. The follow-ups cause a bit of concern: We cannot open up the whole of AbstractDomainObject (and only internal-ize specific methods), because this would allow consumers to extend an internal abstract that we don't want to allow extended. Only (as thanks to your help we also formulatted better) the AbstractEntity and AbstractValueObject should be extended - and removing `@internal` there would then be indicative of "proper API use". We can't easily forbid this (unless using runtime class extension analysis and throwing exceptions). Moving vital getUid/getPid methods around might also cause breakage. There are (ugly) workarounds possible that we can discuss in the follow-up issues. For now, let's go babysteps and at least use this patch here which improves the situation a bit to allow such workarounds: ``` $data[] = $this->getUid($blog); // ... private function getUid(DomainObjectInterface $object): ?int { return $object->getUid(); } ``` or ``` /** @var DomainObjectInterface $object */ $object = $blog; $data[] = $object->getUid(); ``` (using `$blog->...` accessors for the actual implementation, and `$object` for type-hinted abstract method-level access). Hat tip to Benjamin Franzke for coming up with this, but I see that is a work-around and not a solution. Moving the methods might be something for v15 of course.
  19. Benjamin Franzke commented on patch set 2 04/16/26, 16:28

    Works for me via ``` /** @var DomainObjectInterface $object */ $object = $myobject; $object->getUid(); ``` There is still a PHPstan bug, which prevents direct public API derivation based on `$myobject`, but that is really an analysation bug which we should try to get fixed upstream in PHPstan.
  20. Garvin Hicking merged patch set 3 04/16/26, 16:38