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

[Regression] Removing default taxonomylink route leads to exception #3070

Closed
Pinpickle opened this issue Mar 9, 2015 · 5 comments
Closed
Labels
bug A bug that has been verified regression

Comments

@Pinpickle
Copy link
Contributor

I like taxonomies, but a lot of the time I don't want their urls so I just remove them. Commenting them out in routing.yml gives me the following:

image

Symfony\Component\Routing\Exception\RouteNotFoundException thrown with message "Unable to generate a URL for the named route "taxonomylink" as such route does not exist.

Stacktrace:
#13 Symfony\Component\Routing\Exception\RouteNotFoundException in /Users/christian/Code/web/bolt/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php:134
#12 Symfony\Component\Routing\Generator\UrlGenerator:generate in /Users/christian/Code/web/bolt/src/Content.php:545
#11 Bolt\Content:setTaxonomy in /Users/christian/Code/web/bolt/src/Storage.php:2257
#10 Bolt\Storage:getTaxonomy in /Users/christian/Code/web/bolt/src/Storage.php:1611
#9 Bolt\Storage:hydrateRows in /Users/christian/Code/web/bolt/src/Storage.php:1706
#8 Bolt\Storage:executeGetContentQueries in <#unknown>:0
#7 call_user_func in /Users/christian/Code/web/bolt/src/Storage.php:1772
#6 Bolt\Storage:getContent in /Users/christian/Code/web/bolt/src/Controllers/Frontend.php:103
#5 Bolt\Controllers\Frontend:homepage in <#unknown>:0
#4 call_user_func_array in /Users/christian/Code/web/bolt/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php:145
#3 Symfony\Component\HttpKernel\HttpKernel:handleRaw in /Users/christian/Code/web/bolt/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php:66
#2 Symfony\Component\HttpKernel\HttpKernel:handle in /Users/christian/Code/web/bolt/vendor/silex/silex/src/Silex/Application.php:543
#1 Silex\Application:handle in /Users/christian/Code/web/bolt/vendor/silex/silex/src/Silex/Application.php:520
#0 Silex\Application:run in /Users/christian/Code/web/bolt/index.php:16

There is a simple enough hackfix for this - just give the taxonomylink a path that is already taken (such as / for the home page) and give it a lower priority than the other route.

I am aware of the disclaimer in routing.yml

Changing these might give unexpected results or even break your website

But this change isn't an exceptional requirement, so I don't think it should be one to break the website.

@CarsonF
Copy link
Member

CarsonF commented Mar 9, 2015

Yeah I made that change. The keys of the taxonomy list is the url, so setting them all to "/" would overwrite all subsequent taxonomies.

@CarsonF
Copy link
Member

CarsonF commented Mar 9, 2015

We could fallback to taxonomytype/slug but that would just be a broken link. Does that help you @Pinpickle? I'm assuming you don't create links for the taxonomy items in your twig template.

@Pinpickle
Copy link
Contributor Author

I think that would work well, when I put in taxonomy routes manually, that is the format I use.

Records use some sort of magic to detect the route their assigned when I manually change them (such as when I change the page route to just /{slug} instead of /page/{slug})

Would taxonomies be able to employ a similar magic?

@CarsonF
Copy link
Member

CarsonF commented Mar 9, 2015

Your magic is your magic 🎱 We just need to keep the keys unique. Personally I don't like the format, but we can't change it without breaking BC. I think the fact that it will be a bad link is fine, given the disclaimer you mentioned.

@CarsonF
Copy link
Member

CarsonF commented Mar 9, 2015

It used to be this:

$link = sprintf("%s%s/%s", $this->app['paths']['root'], $taxonomytype, $slug);

Should the fallback be that ^ or:

$link = $taxonomytype . '/' . $slug;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug that has been verified regression
Projects
None yet
Development

No branches or pull requests

3 participants