I'm using the datamapper in my extension to get a object array of my querybuilder result. It worked under Typo3 8.7, but not anymore under Typo3 10.4.9. The querybuilder delivers the correct result. After the datamapper took my results from the querybuilder, the object array has the correct number of entries and the properties; but the properties are empty/null.

...
/**
 * Datamaper
 *
 * @var DataMapper
 * @TYPO3\CMS\Extbase\Annotation\Inject
 */
protected DataMapper $datamapper;

...

$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_address');

$records = $queryBuilder
    ->select('tt_address.*')
    ->from('tt_address')
    ->leftJoin(
        'tt_address',
        'tt_content',
        'content',
        $queryBuilder->expr()->eq('content.tx_myext_parent', $queryBuilder->quoteIdentifier('tt_address.uid'))
    )
    ->where(
        $queryBuilder->expr()->eq('tt_address.deleted', 0),
        $queryBuilder->expr()->eq('tt_address.hidden', 0)
    )
    ->groupBy('tt_address.uid')
    ->execute()->fetchAll();

$result = $this->datamapper->map(\Vendor\MyExt\Domain\Model\Adresse::class, $records);

My class:

class Adresse extends \FriendsOfTYPO3\TtAddress\Domain\Model\Address
{
...
/**
 * teaser
 *
 * @var string
 */
protected string $teaser = '';
...

Do you have any idea what's missing or what I'm doing wrong?

1

There are 1 best solutions below

0
On BEST ANSWER

The problem was, that the mapping has changed since Typo3 10.0. The solution can be found here:

Typo3 docs