假设我们有 2 个 TYPO3 扩展,每个扩展都包含一个 Extbase 插件,并且每个扩展都提供路由器 YAML 配置:
# Route config for myext_aaa which contains the Extbase plugin "Checkout" using CheckoutController
routeEnhancers:
MyextAaaCheckout:
type: Extbase
extension: myext_aaa
plugin: Checkout
routes:
-
routePath: '/{localized-order-new}/{course-name}'
_controller: 'Checkout::newOrder'
_arguments:
course-name: 'course'
aspects:
course-name:
type: PersistedAliasMapper
tableName: my_course_table
routeFieldName: slug
localized-order-new:
type: LocaleModifier
default: 'order'
localeMap:
- locale: 'de_DE.*'
value: 'buchen'
# Route config for myext_zzz which contains the Extbase plugin "CheckoutXxx" using CheckoutXxxController
routeEnhancers:
MyextZzzCheckoutXxx:
type: Extbase
extension: mzext_zzz
plugin: CheckoutXxx
routes:
-
routePath: '/{zzz-localized-order-new}/{course-name}'
_controller: 'CheckoutXxx::newOrder'
_arguments:
course-name: 'course'
aspects:
course-name:
type: PersistedAliasMapper
tableName: my_course_table
routeFieldName: slug
zzz-localized-order-new:
type: LocaleModifier
default: 'order'
localeMap:
- locale: 'de_DE.*'
value: 'buchen'
现在我们有 2 个页面,每个页面包含一个插件:
- 在第 1 页,插件“Checkout”位于:
my-site.net/page1/buchen/how-to-code-course
- 在第 2 页上,插件“CheckoutXxx”位于:
my-site.net/page2/buchen/how-to-code-course
问题
打开 page1 的 URL 会导致错误,因为CheckoutController::orderNewAction(Course $course)
缺少$course
参数!似乎/buchen/{course-name}
使用了“mzext_zzz”中的路由配置(或覆盖第一个定义)。但为什么?路由器是否没有extension: mzext_zzz
考虑plugin: CheckoutXxx
路由定义?
或者换句话说:该路由怎么可能/buchen/{course-name}
被来自两个不同扩展的两个完全不同的插件使用?