Inside my Extbase extension, I have two classes ParentUser and Child.
The child table holds a reference to the parent_user
CREATE TABLE tx_xxx_domain_model_child (
...
parent_user int(11) unsigned DEFAULT '0'
)
The parent_user table doesn’t know about the Child.
Is it possible to hydrate the ParentUser object in such a way, that it holds a ObjectStorage (or similar) of children.
I want to render a list of all ParentUsers with its children.
Note, I don’t want the model to know about any repository. It would be nice to use the ProppertyMapper.
Some more Code:
TCA:
...
'parent_user' => [
'exclude' => false,
'label' => 'LLL:EXT:xxx/Resources/Private/Language/locallang_db.xlf:tx_xxx_domain_model_child.parent_user',
'description' => 'LLL:EXT:xxx/Resources/Private/Language/locallang_db.xlf:tx_xxx_domain_model_child.parent_user.description',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'tx_xxx_domain_model_parentuser',
'default' => 0,
'minitems' => 0,
'maxitems' => 1,
],
],
CREATE TABLE tx_xxx_domain_model_child (
first_name varchar(255) DEFAULT NULL,
last_name varchar(255) DEFAULT NULL,
date_of_archive int(11) NOT NULL DEFAULT '0',
state int(11) NOT NULL DEFAULT '0',
parent_user int(11) unsigned DEFAULT '0'
);
CREATE TABLE tx_xxx_domain_model_parentuser (
first_name varchar(255) DEFAULT NULL,
last_name varchar(255) DEFAULT NULL,
email varchar(255) DEFAULT NULL,
city varchar(255) DEFAULT NULL,
zip varchar(255) DEFAULT NULL,
region varchar(255) DEFAULT NULL,
country varchar(255) DEFAULT NULL,
address varchar(255) DEFAULT NULL,
date_of_archive int(11) NOT NULL DEFAULT '0',
state int(11) NOT NULL DEFAULT '0'
);
Using:
- TYPO3 v12.4.18 + Extbase
- PHP 8.2.22