Skip to content

Problem on https://docs.typo3.org/m/typo3/reference-coreapi/13.4/en-us//ExtensionArchitecture/Extbase/Reference/Domain/Model/Relations/Index.html #6093

@killerwhale9

Description

@killerwhale9

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 $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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions