Issue Bug Resolved

#109494Extbase DataMapper ignores fields defined in TCA "ctrl"

Anton Danilov 04/06/26, 14:49 updated 10/19/26, 20:05

Description

Fields defined in the `ctrl` section of a TCA (like `tstamp` or `crdate`) are not automatically mapped to properties in an Extbase domain model. They must also be defined in the `columns` section for the `DataMapper` to recognise them when reading database records.

This leads to an inconsistent developer experience: the system knows the field exists and can write to it automatically (via `DataMap`), but cannot read it into a model without additional boilerplate.

A typical TCA setup:


'table' => [
    'ctrl' => [
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
    ],
    // 'tstamp' and 'crdate' are NOT defined in 'columns'
    'columns' => [
        // ...
    ],
],

And a model:

class MyModel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
    protected ?int $tstamp = null;

    public function getTstamp(): ?int
    {
        return $this->tstamp;
    }
}

*Expected behaviour:*
The `$tstamp` property should be populated with the value from the database.

*Actual behaviour:*
The `$tstamp` property remains `null` because the DataMapper only maps fields listed in the `columns` section.

Proposed Solution

Modify the `DataMapFactory` to automatically generate a simple `ColumnMap` for fields defined in `ctrl` (e.g., `tstamp`, `crdate` etc) if they are missing from the `columns` section. This would be done by checking the `TcaSchemaCapability` for `UpdatedAt`, `CreatedAt`, etc.

The `DataMapper` already loops over all persistable properties with a valid `ColumnMap`. By adding these missing maps, the fields would be hydrated without any additional TCA configuration.

Reviews 1

Files 1

History 513

  1. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-04-06T16:36:51+00:00" > 04/06/26, 16:36 </span>

    I’ve faced this a few times and I’m not remembering what the reasons where (if any) to not have this. Maybe I remember later. ;)

    Would you like to add your patch to our review system so it can also be attributed to you? We’ll probably need to add verifying patches for this too, and very likely adapt tests.

    Thanks!

  2. Anton Danilov commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-10-19T20:05:14+00:00" > 10/19/26, 20:05 </span>

    Applied in changeset commit:deee538c4ab152ae8f8a4508e5979cd171b20005.