Search code examples
routesmigrationtypo3realurl

TYPO3 9.5: RealURL Migration - postVarSets - Extbase RouteEnhancer


I had following RealURL Configuration (part):

`'postVarSets' => array(
    '_DEFAULT' => array(
             'level1' => array(
                 array(
                   'GETvar' => 'tx_bitproducts_productview[industryLevel1]',             
                     'lookUpTable' => array(
                         'table' => 'tx_bitproducts_domain_model_industry',
                         'id_field' => 'uid',
                         'alias_field' => 'industriename',
                         'addWhereClause' => ' AND NOT deleted ', 
                         'useUniqueCache' => 1,
                         'useUniqueCache_conf' => array(
                             'strtolower' => 1,
                             'spaceCharacter' => '-'
                         ),
                     )
                 ),
             ),
            'level2' => array(
              array(
                  'GETvar' => 'tx_bitproducts_productview[industryLevel2]',
                  'lookUpTable' => array(
                      'table' => 'tx_bitproducts_domain_model_industrylevel2',
                      'id_field' => 'uid',
                      'alias_field' => 'name',
                      'addWhereClause' => ' AND NOT deleted ', 
                      'useUniqueCache' => 1,
                      'useUniqueCache_conf' => array(
                          'strtolower' => 1,
                          'spaceCharacter' => '-'
                      ),
                  ),
              ),
          ),
...`

which resulted in URLs like

.../level1/automotive/
and
.../level2/wheels/

all was handled by one Extbase Controller Action. How could an Extbase RouteEnhancer for TYPO3 9 could look like ? I would use Slug TCA for these fields.

Thanks for any hints !


Solution

  • Possible configuration for your example can look like:

    routeEnhancers:
      BitProducts:
        type: Extbase
        extension: BitProducts (or something like that, depends how called your extension)
        plugin: Productview (or something like that, depends how called your plugin)
        routes:
          - { routePath: '/level1/{level1}', _arguments: {level1: 'industryLevel1'} }
          - { routePath: '/level2/{level2}', _arguments: {level2: 'industryLevel2'} }
        defaultController: 'Controller::action'
        aspects:
          level1:
            type: PersistedAliasMapper
            tableName: 'tx_bitproducts_domain_model_industry'
            routeFieldName: 'slug'
          level2:
            type: PersistedAliasMapper
            tableName: 'tx_bitproducts_domain_model_industrylevel2'
            routeFieldName: 'slug'