Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New simplified AliasMapper for News Routing throws a warning #2046

Open
instruccionesaldorso opened this issue Mar 26, 2023 · 4 comments
Open

Comments

@instruccionesaldorso
Copy link

After upgrading to 11.0.0 version (TYPO3 11.5.25) and using the new simplified AliasMapper for News Routing introduced by Benni e6b74fb, the next warning is displayed:

(1/1) #1476107295 TYPO3\CMS\Core\Error\Exception
PHP Warning: Undefined array key "type" in /var/www/html/public/typo3conf/ext/news/Classes/Routing/NewsAliasMapper.php line 37

I'm using "List articles with detail view (news_pi1)" plugin and NO dedicated detail page (list and detail are on the same page).

Here my route enhancer configuration:

routeEnhancers:
  News:
    type: Extbase
    limitToPages:
      - 123
    extension: News
    plugin: Pi1
    routes:
      - routePath: '/{news-title}'
        _controller: 'News::detail'
        _arguments:
          news-title: 'news'
    defaultController: 'News::list'
    aspects:
      news-title:
        type: NewsTitle

Debugging the class NewsAliasMapper, over __construct function, variable $settings is an empty array.

@websi
Copy link
Contributor

websi commented Mar 29, 2023

TYPO3 remove the type from the settings within TYPO3 11. https://github.com/TYPO3/typo3/blob/11.5/typo3/sysext/core/Classes/Routing/Aspect/AspectFactory.php#L100

@aksenovaa
Copy link

Confirmed, had to go back to the old configuration:

  News:
    type: Extbase
    limitToPages:
      - 96
      - 97
      - 104
      - 105
    extension: News
    plugin: Pi1
    routes:
      - routePath: '/'
        _controller: 'News::list'
      - routePath: '/page-{page}'
        _controller: 'News::list'
        _arguments:
          page: 'currentPage'
      - routePath: '/tag-{tag-name}'
        _controller: 'News::list'
        _arguments:
          tag-name: overwriteDemand/tags
      - routePath: '/tag-{tag-name}/page-{page}'
        _controller: 'News::list'
        _arguments:
          tag-name: overwriteDemand/tags
          page: 'currentPage'
      - routePath: '/{news-title}'
        _controller: 'News::detail'
        _arguments:
          news-title: news
      - routePath: '/cat-{category-name}'
        _controller: 'News::list'
        _arguments:
          category-name: overwriteDemand/categories
    defaultController: 'News::list'
    defaults:
      page: '0'
    #      tag-name: ''
    aspects:
      news-title:
#        type: NewsTitle
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_news
        routeFieldName: path_segment
      page:
        type: StaticRangeMapper
        start: '1'
        end: '100'
      category-name:
#        type: NewsCategory
        type: PersistedAliasMapper
        tableName: sys_category
        routeFieldName: slug
      tag-name:
#        type: NewsTag
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_tag
        routeFieldName: slug

One more observation, but an important one. Troubled with this for a couple of hours after the update. And at first it worked, and then suddenly stopped (apparently the cache was updated or something like that).
I had to change the sequence in the routs:

  • routePath: '/page-{page}'
    ...
  • routePath: '/tag-{tag-name}'
    ...
  • routePath: '/tag-{tag-name}/page-{page}'
    ...
  • routePath: '/{news-title}'

After that, the pages in the tag listing and the simple listing are working.

@bavarianbytes
Copy link

Can confirm this

@ineswillenbrock
Copy link

ineswillenbrock commented May 6, 2023

I can confirm this for news 11.0.0. and TYPO3 11.5.26 with PHP >=8.0, it seems to work fine on TYPO3 11.5.26 with PHP 7.4
legacy/non-composer install without ddev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants