带有方面的 RouteEnhancer 抛出 InvalidParameterException [英] RouteEnhancer with aspects throws InvalidParameterException
问题描述
我逐字使用了更新日志:
我唯一改变的是limitToPages.
The only thing I changed was the limitToPages.
routeEnhancers:
NewsPlugin:
type: Extbase
limitToPages: [82]
extension: News
plugin: Pi1
routes:
- { routePath: '/{news_title}', _controller: 'News::detail', _arguments: {'news_title': 'news'} }
defaultController: 'News::detail'
aspects:
news_title:
type: PersistedAliasMapper
tableName: 'tx_news_domain_model_news'
routeFieldName: 'path_segment'
routeValuePrefix: '/'
这会在 9.5.4 中引发异常:
This throws an exception in 9.5.4:
Symfony\Component\Routing\Exception\InvalidParameterException
Parameter "tx_news_pi1__news" for route "tx_news_pi1_0" must match "[^/]++" ("" given) to generate a corresponding URL.
in /var/www/example/htdocs/typo3_src-9.5.4/vendor/symfony/routing/Generator/UrlGenerator.php line 155
at Symfony\Component\Routing\Generator\UrlGenerator->doGenerate(array('tx_news_pi1__news' => 0), array('_controller' => 'News::detail'), array(), array(array('variable', '/', '[^/]++', 'tx_news_pi1__news', true), array('text', '/aktuelles/artikel')), array('tx_news_pi1__news' => ''), 'tx_news_pi1_0', 1, array(), array())
in /var/www/example/htdocs/typo3_src-9.5.4/vendor/symfony/routing/Generator/UrlGenerator.php line 128
目前,不存在其他路由增强器.但是我在完全相同的页面上成功地使用了更简单的配置并且有效:
Currently, no other route enhancers exist. But I successfully used a simpler configuration on that exact same page and that worked:
NewsDetail:
type: Extbase
limitToPages: [82]
extension: News
plugin: Pi1
routes:
- { routePath: '/{news_id}', _controller: 'News::detail', _arguments: {'news_id': 'news'} }
不确定在哪里查看以及如何最好地进行故障排除.我希望有人有类似的问题,或者可以为我指明正确的方向.
Not sure where to look and how best to troubleshoot. I was hoping someone had similar problem or could point me in the right direction.
推荐答案
检查空 path_segment 是否是这里的问题:
Check if empty path_segment is the problem here:
select count(*) from tx_news_domain_model_news where path_segment='';
修复
如果有空标题的新闻条目,您可能需要先删除这些或更新标题.
Fix
If there are news entry with empty titles, you may want to remove these or update the title first.
- 运行更新向导:更新 EXT:news 记录的 slug 字段path_segment""(您可能需要先在升级向导中将其标记为已取消"(BE:升级 > 升级向导 > 运行升级向导)
- 或者手动设置 tx_news_domain_model_news.path_segment
这篇关于带有方面的 RouteEnhancer 抛出 InvalidParameterException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!