Review main Merged

90296[FEATURE] Use properties for configuration of Extbase attributes

Elias Häußler CR +2 V +2 Hard +646 −214 updated 12/31/25, 08:01

Commit message

When Extbase annotations were added in TYPO3 v9, the possibility to
define configuration options was quite limited. All available options
needed to be defined in a single array. Since annotations were dropped
with #107229 in favor of PHP attributes, the definition of configuration
options is now possible in a more flexible way.

This patch serves as follow-up to #107229 and strives to improve the
attribute configuration option mechanism by using constructor property
promotion in combination with strictly typed properties. In order to
maintain backwards compatibility, the first property of each attribute
still accepts an array with configuration options to be passed. However,
this is considered deprecated and will be dropped with TYPO3 v15.0.
Developers are advised to migrate towards single properties when using
PHP attributes in Extbase.

Example migration
=================

Before:
-------

    use TYPO3\CMS\Extbase\Attribute\FileUpload;
    use TYPO3\CMS\Extbase\Attribute\Validate;
    use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
    use TYPO3\CMS\Extbase\Domain\Model\FileReference;

    class MyModel extends AbstractEntity
    {
        #[Validate(['validator' => 'NotEmpty'])]
        protected string $foo = '';

        #[FileUpload([
            'validation' => [
                'required' => true,
                'maxFiles' => 1,
                'fileSize' => ['minimum' => '0K', 'maximum' => '2M'],
                'allowedMimeTypes' => ['image/jpeg', 'image/png'],
            ],
            'uploadFolder' => '1:/user_upload/files/',
        ])]
        protected ?FileReference $bar = null;
    }

After:
------

    use TYPO3\CMS\Extbase\Attribute\FileUpload;
    use TYPO3\CMS\Extbase\Attribute\Validate;
    use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
    use TYPO3\CMS\Extbase\Domain\Model\FileReference;

    class MyModel extends AbstractEntity
    {
        #[Validate(validator: 'NotEmpty')]
        protected string $foo = '';

        #[FileUpload(
            validation: [
                'required' => true,
                'maxFiles' => 1,
                'fileSize' => ['minimum' => '0K', 'maximum' => '2M'],
                'allowedMimeTypes' => ['image/jpeg', 'image/png'],
            ],
            uploadFolder: '1:/user_upload/files/',
        )]
        protected ?FileReference $bar = null;
    }

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Torben Hansen +1
    • Lina Wolf +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Oliver Klee +1
    • Torben Hansen +1
    • Lina Wolf +1
    • core-ci +1 CI

Issues 2

Files 40

Show 20 more files

Review log 3042

Show 1017 earlier messages
  1. Elias Häußler uploaded patch set 1 08/08/25, 12:53

  2. Elias Häußler updated the commit message in patch set 2 08/08/25, 12:54

  3. core-ci voted on patch set 2 V -1 08/08/25, 13:05 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83018

  4. Elias Häußler wrote 08/21/25, 06:55

    Topic set to extbase
  5. Elias Häußler uploaded patch set 3 V -1 10/10/25, 08:18

  6. core-ci voted on patch set 3 V -1 10/10/25, 08:34 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86366

  7. Elias Häußler uploaded patch set 4 V -1 10/13/25, 14:25

  8. core-ci voted on patch set 4 V -1 10/13/25, 14:39 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86548

  9. Elias Häußler uploaded patch set 5 V -1 10/14/25, 12:56

  10. core-ci voted on patch set 5 V -1 10/14/25, 13:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86629

  11. Elias Häußler uploaded patch set 6 V -1 10/14/25, 14:01

  12. core-ci voted on patch set 6 V +1 10/14/25, 14:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86636

  13. Elias Häußler uploaded patch set 7 V +1 10/14/25, 15:06

  14. Elias Häußler marked it ready for review 10/14/25, 15:07

  15. Elias Häußler uploaded patch set 8 10/14/25, 15:12

  16. core-ci voted on patch set 7 V -1 10/14/25, 15:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86644

  17. core-ci voted on patch set 8 V +1 10/14/25, 15:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86646

  1. Elias Häußler uploaded patch set 9 V +1 10/14/25, 15:24

  2. core-ci voted on patch set 9 V +1 10/14/25, 15:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86648

  3. Elias Häußler updated the commit message in patch set 10 V +1 10/14/25, 19:53

  4. core-ci voted on patch set 10 V +1 10/14/25, 20:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86656

  5. Oliver Klee voted on patch set 10 V +1 10/15/25, 07:10

  6. Benni Mack commented on patch set 10 10/21/25, 15:48

    Feature-97559-UsePropertiesForConfigurationOfExtbaseAttributes.rst:6

    shouldn't it be called "Use attributes for configuration of Extbase properties"?
  7. Elias Häußler commented on patch set 10 11/10/25, 09:09

    Feature-97559-UsePropertiesForConfigurationOfExtbaseAttributes.rst:6 Reply

    This patch changes construction of attribute properties from a single array to multiple properties: **Before:** ```php #[Validate([ 'validator' => 'NotEmpty', 'options' => [ 'nullMessage' => 'Value must not be empty.', ], ]) ``` **After:** ```php #[Validate( validator: 'NotEmpty', options: [ 'nullMessage' => 'Value must not be empty.', ] ) ``` Hence, I'd say the title is correct as-is. But I'm of course open to a more precise naming.
  8. Torben Hansen voted on patch set 10 CR +1 V +1 11/13/25, 20:59

  9. Lina Wolf commented on patch set 10 11/14/25, 03:46

    Feature-97559-UsePropertiesForConfigurationOfExtbaseAttributes.rst:6

    ```suggestion Feature: #97559 - Support property-based configuration for Extbase attributes ```
  10. Elias Häußler uploaded patch set 11 CR +1 V +1 11/14/25, 07:30

  11. Elias Häußler commented on patch set 11 11/14/25, 07:31

    Feature-97559-UsePropertiesForConfigurationOfExtbaseAttributes.rst:6 Reply

    Done
  12. core-ci voted on patch set 11 V -1 11/14/25, 07:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89655

  13. Elias Häußler uploaded patch set 12 V -1 11/14/25, 07:58

  14. core-ci voted on patch set 12 V +1 11/14/25, 08:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89658

  15. Elias Häußler commented on patch set 12 11/14/25, 08:28

    Feature-97559-UsePropertiesForConfigurationOfExtbaseAttributes.rst:6 Reply

    Done
  16. Torben Hansen voted on patch set 12 CR +1 V +1 11/14/25, 08:29

  17. Oliver Klee voted on patch set 12 V +1 11/14/25, 09:00

  18. Christian Kuhn rebased onto patch set 13 CR +1 V +1 11/20/25, 12:06

  19. Oliver Klee voted on patch set 13 V +1 11/20/25, 12:07

  20. Torben Hansen voted on patch set 13 CR +1 V +1 11/20/25, 12:11

  21. core-ci voted on patch set 13 V +1 11/20/25, 12:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90275

  22. Lina Wolf voted on patch set 13 CR +1 V +1 11/20/25, 12:14

  23. Christian Kuhn voted on patch set 13 CR +2 V +2 11/20/25, 13:10

  24. Christian Kuhn merged patch set 14 11/20/25, 13:10

  25. Lina Wolf commented on patch set 14 12/31/25, 08:01