Project

General

Profile

Bug #87333

Updated by Guido Schmechel over 5 years ago

*Context* 

 I combine two fields via TCA Slug ['city', 'street']. TYPO3 builds the slug correctly to e.g. "cologne/streetname". This is also displayed in the backend in the slug field. 

 <pre><code class="php"> 
         'slug' => [ 
             'exclude' => true, 
             'label' => 'URL Segment', 
             'config' => [ 
                 'type' => 'slug', 
                 'generatorOptions' => [ 
                     'fields' => ['city', 'street', 'uid'], 
                     'fieldSeparator' => '-', 
                     'replacements' => [ 
                         '/' => '', 
                         '&' => '' 
                     ], 
                 ], 
                 'fallbackCharacter' => '-', 
                 'eval' => 'uniqueInPid', 
             ], 
         ], 
 </code></pre> 


 *Problem* 

 If i call a list action which call this slug via f:link.page I get this error message: 

 <pre> 
 Parameter "tx_ayacoopoi_poi__poi" for route "tx_ayacoopoi_poi_0" must match "[^/]++" ("cologne/streetname" given) to generate a corresponding URL. 
 </pre> 

 I have not defined a field separator in the TCA config and so a slash is used by the code => https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/core/Classes/DataHandling/SlugHelper.php#L185 

 Symfony routing is in strict mode and so the slash isn't allowed. 


 *Route Enhancer* 

 <pre><code class="yaml"> 
 routeEnhancers: 
   DetailPoi: 
     type: Extbase 
     extension: AyacooPoi 
     plugin: Poi 
     routes: 
       - { routePath: '{slug}', _controller: 'Poi::detail', _arguments: {'slug' : 'poi'} } 
     defaultController: 'Poi::detail' 
     aspects: 
       slug: 
         type: PersistedAliasMapper 
         tableName: 'tx_ayacoopoi_domain_model_poi' 
         routeFieldName: 'slug' 
         routeValuePrefix: '/' 
 </code></pre> 

Back