5

I used the example verbatim from the Changelog:

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: '/'

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.

Sybille Peters
  • 2,832
  • 1
  • 27
  • 49
  • 2
    I did seen this error before. Ensure your news entries have slug filled with valid values. Se DB `tx_news_domain_model.path_segment`. If not, there is an Installtool Upgrade Wizard. – jokumer Mar 01 '19 at 16:32
  • Thanks. That was the problem. I did use the Upgrade Wizard. Some of these entries were not converted. Only a handful. The rest looks ok. Not sure why. If path_segment is set to some value, the exception disappears. – Sybille Peters Mar 01 '19 at 18:01
  • ...entries were not converted... Upgrade wizard should work for all news entries, where path_segement is empty. Does those of your failed entries have a valid title? Otherwise we should investigate, why convertion failed. – jokumer Mar 02 '19 at 00:42
  • I'll check it out ... will be back with more info. – Sybille Peters Mar 04 '19 at 06:40
  • tx_news_domain_model_news.path_segment already exists in original TYPO3 8 instance of which a clone was used to update to TYPO3 9. Here, some of the entries (67 of over 2000) have an empty path_segement. Of these, 17 have empty title. For the other the title is filled. So this is an "older" issue and I am not sure if it is worth the effort to track it down. – Sybille Peters Mar 04 '19 at 09:33
  • Marking "Updates slug field "path_segment" of EXT:news records" of news extension" wizard as done and running it again throws exception: "No valid wizard identifier given". – Sybille Peters Mar 04 '19 at 10:10
  • I mean, there is currently an issue with UpgradeWizard identifiers, in TYPO3 9. But did not found any solution yet. Its even more invalid, if you use typo3_console at the moment. You can edit manually in DB - to solve this temporarly – jokumer Mar 04 '19 at 15:25
  • Can you add a link? – Sybille Peters Mar 05 '19 at 09:46
  • https://github.com/TYPO3-Console/TYPO3-Console/issues/795#issuecomment-459753127 https://review.typo3.org/c/Packages/TYPO3.CMS/+/58197 – jokumer Mar 06 '19 at 10:20
  • @jokumer. Thanks for your help. I am not sure this is the same problem. Shouldn't this be fixed in 9.5.5? Just came out. the sys_registry contains class names only. I am starting a new question on this because it is related but handling this in comments probably not the best idea. https://stackoverflow.com/questions/55025974/exception-on-executing-extnews-upgrade-wizard-for-updating-path-segment-in-typo – Sybille Peters Mar 06 '19 at 14:54

2 Answers2

7

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.

  • Run update wizard: "Updates slug field "path_segment" of EXT:news records" (you may have to mark it as "undone" in Upgrade Wizard first (BE: Upgrade > Upgrade Wizard > Run Upgrade Wizard)
  • Or manually set tx_news_domain_model_news.path_segment
Sybille Peters
  • 2,832
  • 1
  • 27
  • 49
  • 1
    The missing value for "path_segment" can happen if an editor doesn't have permissions on that field. The permissions to that exclude field has to be granted otherwise the value will be "" if an editor creates a new news entry. – Uwe Trotzek Dec 16 '20 at 12:43
1

Same problem for me, the problem was because 'path_segment' generated with Install Tool Wizard had a slash, like : "the-path/another-segment"

The solution is to check for slash in 'path_segment' and replace them with another symbol, request like this :

SELECT uid, pid, path_segment, title FROM tx_news_domain_model_news WHERE path_segment LIKE "%/%";

and change path_segment like that : "the-path_another-segment"

Florian Rival
  • 601
  • 4
  • 11