Issue Feature Under Review

#111621Serialize link arguments from properties marked with #[UriArgument]

Alexander Schnitzler 11/26/26, 13:36 updated 11/26/26, 14:59

Description

Extbase links can carry objects that are not entities, for example a demand or filter DTO passed to uriFor() or f:link.action. Today this only works for subclasses of AbstractValueObject, which the UriBuilder serializes with all their properties. This has several problems:

  • every property ends up in the link, including internal state
  • backed enums are written as [name] and [value] and cannot be mapped back
  • DateTime properties make the whole argument vanish from the link
  • a cycle in the object graph exhausts the memory
  • the controller has to allow all properties (allowAllProperties() plus CONFIGURATION_CREATION_ALLOWED), so a visitor can set any property that has a setter

A new property attribute #[TYPO3\CMS\Extbase\Attribute\UriArgument] marks the properties that belong into the link.

Outbound, the UriBuilder serializes only the marked properties of an object, by property name:

  • scalars and null
  • backed enums as their value
  • entities as their uid
  • DateTimeInterface in the format the DateTimeConverter reads by default
  • nested objects with marked properties, recursively
  • iterables of these

Other values and cycles throw an exception that names the class and the property.

Inbound, Extbase derives the property mapping configuration of an action argument from the same attribute: the marked properties, recursively, are allowed, and others are not. The controller needs no configuration for links anymore. An explicit configuration in initialize*Action() still wins, and for a submitted f:form its trusted properties apply.

The serialization of AbstractValueObject in the UriBuilder will be deprecated in a separate issue and removed in v16.

A spike covered round trips for these types including cHash, route enhancers, f:link.action and validators.

Reviews 1

History 01

  1. Gerrit Code Review pushed patch set 1 for main to change 98076 status New Under Review 11/26/26, 14:59