Search code examples
mappingtypo3persistenceextbase

Typo3 v10 Persistence Mapping foreignClass


since Typo3 v10 you have to use Classes.php file in Configuration/extbase/Persistence Folder for configuration of persistence table mapping.

Does anyone know how to implement

config.tx_extbase.persistence.classes {

    Domain\DomainUsergroupMailer\Domain\Model\FrontendUserGroups { 
    mapping {
        tableName = fe_groups
        columns {
            subgroup.foreignClass = TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup
        }
    } 
}

I can't find documentation concerning the foreignClass Parameter. I found parameter subclasses in https://docs.typo3.org/m/typo3/book-extbasefluid/10.4/en-us/6-Persistence/5-modeling-the-class-hierarchy.html

Does anyone know if this is the right way parameter and how to use it?

Thank you


Solution

  • There never was such a feature in TYPO3 as confirmed by searching the TYPO3v9 source code for foreignClass. So this must be provided by a 3rd party extension.

    However, from the name it sounds like you only need to use an appropriate element type for your collection relation:

    /**
     * @var ObjectStorage<FrontendUserGroup>
     */
    private ObjectStorage $subgroup;
    

    See Implementing the domain model for details.