TYPO3CMS-Reference-CoreApi
TYPO3CMS-Reference-CoreApi copied to clipboard
Problem on https://docs.typo3.org/m/typo3/reference-coreapi/13.4/en-us//ExtensionArchitecture/Extbase/Reference/Domain/Model/Relations/Index.html
Current behavior
The “m:n relationship” section of the Extbase Relations documentation contains a code snippet that does not reflect an m:n relationship.
It currently shows:
protected ?Person $author = null;
protected ?Person $secondAuthor = null;
This actually illustrates an n:1 relation (a post has one author), not an m:n relation between Post and Category as described in the preceding text.
This can lead to confusion for readers trying to understand how to implement m:n relations in Extbase.
Expected behavior/output
The example for an m:n relationship should:
Show a Post model containing an ObjectStorage<Category> $categories property.
Optionally show the inverse relation in the Category model.
Reflect a real many-to-many relation consistent with the description above the code snippet.
Possibly reference the required TCA configuration with MM table.
Links
Documentation page: https://docs.typo3.org/m/typo3/reference-coreapi/13.4/en-us/ExtensionArchitecture/Extbase/Reference/Domain/Model/Relations/Index.html
Section: m:n relationship (Blog post ↔ Category example)
TYPO3 versions
13.4 (may affect other versions too)
Possible Solution
Replace the current author code snippet with a proper m:n example, e.g.:
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Vendor\Extension\Domain\Model\Category>
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected ObjectStorage $categories;
Add a short TCA example with MM table configuration for clarity.
Additional context
This part of the documentation is frequently referenced by developers learning Extbase relations. Having a correct m:n code sample will avoid misunderstandings between n:1 and m:n relations and improve the learning curve for TYPO3 developers.