Unfortunately, I can not find a normal example in the documentation that is similar to http://symfony.com/doc/current/routing/custom_route_loader.html but I feel this is an option for me in part.

The situation is valid there is a site directory:

site.ru/{+d}/ - displays all products depending on the price

site.ru/{slug}/ - and so a category page can be displayed, or a product depending on the slug (the problem is that in each category or product table there is a corresponding slug field - you can of course make one table (or make a presentation) and by communication one-to-one to get the right slug and then everything will be much easier using forwarding)

i.e., the usual logic can be redirected to the required action controller, depending on what came in the parameter, of course, you can be cheeky, and in the Index controller you can do all these checks and pull out the necessary logic through the service, or go on the easy way (site.ru/ category / {slug} / and site.ru/product/ (asslug ()/), but I want to see somewhere how to make the current situation as much as possible with the “right” approach?

  • and site.ru/catalog/{category_slug}/{product_slug}/ than not suitable? - Mikhail Rebrov
  • The task of the TK is all the cnc is from the root, maybe because the URL was not too long, well, in the version when the category and product is specified in one URL, problems start when the product is in several categories and the breadcrumbs are allowed to specify the category from which the user went Not the main thing, although this is from the point of programming a nonsense, but I saw similar crutches .... - sidni
  • crazy idea .. but once there is such a task, I would still like to distinguish everything at the level of routes ... and I would just make more subtle differences ... for example, the categories would just go from the root site.ru/{slug} , and the products would have site.ru/{slug}.xhtml extension.xhtml ... or there would be an identifier in front of the product, and then site.ru/{id}_{slug} code / site.ru/{id}_{slug} - Mikhail Rebrov
  • but first of all I would discourage the customer (or whoever you have) from such an idea ... because it leads to a dead end - Mikhail Rebrov
  • Yes, I agree that this is a hemorrhoid out of the blue, just in my small symphony, let's say on Yu2, I would relatively simply get out, and here the customer may have an opinion that I have low qualification and that I have to give my two fully realized options and provide on the example of the minuses and advantages of the approaches - sidni

0