TYPO3 9 Routing - the parameter gets overwritten by the defaults - 1 year and 8 months later we are trying to update to TYPO3 10 and after that to TYPO3 11. As you can see, the site-configuration worked für typo3 9 perfectly, but now it won't anymore.
routeEnhancers:
Werbemittelshop:
type: Extbase
extension: Mwwerbemittelshop
plugin: Mwwerbemittelshop
routes:
-
routePath: '/{categoryname}/{categoryname2}/{categoryname3}'
_controller: 'MwWsCategories::category'
_arguments:
categoryname: mwWsCategory
categoryname2: mwWsCategory2
categoryname3: mwWsCategory3
-
routePath: '/{productname}'
_controller: 'MwWsCategories::product'
_arguments:
productname: mwWsProduct
defaults:
categoryname2: ''
categoryname3: ''
defaultController: 'MwWsCategories::category'
aspects:
categoryname:
type: PersistedAliasMapper
tableName: tx_mwwerbemittelshop_domain_model_mwwscategories
routeFieldName: slug
categoryname2:
type: PersistedAliasMapper
tableName: tx_mwwerbemittelshop_domain_model_mwwscategories
routeFieldName: slug
categoryname3:
type: PersistedAliasMapper
tableName: tx_mwwerbemittelshop_domain_model_mwwscategories
routeFieldName: slug
productname:
type: PersistedAliasMapper
tableName: tx_mwwerbemittelshop_domain_model_mwwsproducts
routeFieldName: slug
The "productname" works exactly as expected. It is a readable url like example.de/test123 and it uses the right action of the controller.
"categoryname2" and "categoryname3" are the problems. If I open example.de/category1/ it works but if I add a second or a third parameter my parameters are empty (example.de/category1/category2) and I don't understand it.
/**
* action category
*
* @param \MwWerbemittelshop\Mwwerbemittelshop\Domain\Model\MwWsCategories $mwWsCategory
* @param \MwWerbemittelshop\Mwwerbemittelshop\Domain\Model\MwWsCategories $mwWsCategory2
* @param \MwWerbemittelshop\Mwwerbemittelshop\Domain\Model\MwWsCategories $mwWsCategory3
* @return void
*/
public function categoryAction(
\MwWerbemittelshop\Mwwerbemittelshop\Domain\Model\MwWsCategories $mwWsCategory = null,
\MwWerbemittelshop\Mwwerbemittelshop\Domain\Model\MwWsCategories $mwWsCategory2 = null,
\MwWerbemittelshop\Mwwerbemittelshop\Domain\Model\MwWsCategories $mwWsCategory3 = null
)
{
var_dump($this->request->getArguments());
var_dump($mwWsCategory);
exit;
Can somebody of you find my mistake? I tried so many versions of it and nothing worked. If you have questions or want some more code, just ask for it.
Thanks in advance.