1

I am upgrading a project about training courses and my URL-segments are like:

/category/course/location.html

Got it running with the following configuration:

routeEnhancers:
    PageTypeSuffix:
        type: PageType
        default: '.html'
        map:
            '.html': 0
    CoursePlugin:
        type: Extbase
        limitToPages:
        - 1
        - 15
        - 17
        - 18
    extension: Course
    plugin: Catlist
    namespace: course_catlist
    routes:
         - routePath: '/{category_title}/{course_title}/{location_title}'
         _controller: 'Category::list'
         _arguments: {category_title: 'category', course_title: 'course', location_title: 'location'}
    defaultController: 'Category::list'
    aspects:
        category_title:
            type: PersistedAliasMapper
            tableName: tx_course_domain_model_category
            routeFieldName: 'slug'
        course_title:
            type: PersistedAliasMapper
            tableName: tx_course_domain_model_course
            routeFieldName: 'slug'
        location_title:
            type: StaticValueMapper
            map:
            alle-standorte: 0
            hamburg: 1
            berlin: 2

The problem is now: It's only working if there are values for all 3 parameters set! But for example there could be a segment like

/language-courses/all-courses/berlin.html

The course-parameter is empty, so all "language-courses" in "berlin" are shown in a list.

In realurl it is possible to combine a lookUpTable with a valueMap!

array(
    'GETvar' => 'tx_course_catlist[course]',
    'valueMap' => array(
        'all-courses' => "",
    ),
    'lookUpTable' => array(
        'table' => 'tx_course_domain_model_course',
        'id_field' => 'uid',
        'alias_field' => 'title',
        'addWhereClause' => ' AND deleted=0 ',
        'useUniqueCache' => 1,
        'useUniqueCache_conf' => array(
            'strtolower' => 1,
            'spaceCharacter' => '-',
        ),
    ),
)

How can I adapt this in TYPO3 9? Any experience or ideas? How can I map an empty-value for a segment of a PersistedAliasMapper?

1 Answers1

0

Found a solution:

Create a record with an uid=0 in the database. Call the path-segment-field for example like "all-courses".

This has an unpleasant side effect that the record appears in the TYPO3 backend and if you want to edit it, you get an error message that the UID must not be 0. So just do it via PHPmyadmin...

And you have to make sure that the value passed to course is not NULL but "0" when building the URL.