[SOLVED] Is there an easy way to modify the value of an aspect of a route enhancer?

I have the following routeEnhancers definition:

  routes:
      - routePath: '/orga/{name_lineage}'
        _controller: 'EtbSysCategory::list'
        _arguments:
          name_lineage: etbSysCategory
 aspects:
      name_lineage:
        type: PersistedAliasMapper
        tableName: tx_etb1_domain_model_etbsyscategory
        routeFieldName: name_lineage

which does work as expected. but the values in the field have a not so nice formatting:

LONGPREFIX###v1
LONGPREFIX###v1###v2
LONGPREFIX###v1###v2###v3
LONGPREFIX###v4
LONGPREFIX###v4###v5

I would prefer to have:

v1
v1.v2
v1.v2.v3
v4
v4.v5

is there an easy way to transform the aspect/field values?
I can’t find a documentation how to modify the result with a small modify-function

my try:
I copied the PersistedAliasMapper to MySpecialMapper and modified only the generate() and resolve() functions. The generate() works and the URI looks as expected, but the resolve() on this URI doesn’t work and results only in 404.

Hi @piphi!

Welcome back to talk.typo3.org!

Which TYPO3 version are you using?

Have you tried debugging the PersistedAliasMapper ::resolve() method to see what information is sent to it and how it is processed?

it’s TYPO3 12.4.34
before I started debugging I thought there might be an easier way than an own whole mapper

I’m unfortunately no expert in how the mapper works, but step debugging is where I would have started.

Come to think of it, you may find this example useful as a way to work with different recursive levels.

In the end I extended the PersistedAliasMapper class and inserted my logic in the replaced generate() and resolve() functions.

1 Like