3

I have a symfony2 build on at the moment. I have installed and configured the StofDoctrineExtensionsBundle so that i can store categories for my "store" view in a nestedset structure. This is working perfectly i can output the nested tree perfectly.

What i am now struggling to understand is how to create the routing for each category dynamically within Symfony?

Because categories can be added dynamically, clearly manually adding the routes wont work.

The tree structure is like so:

root: - Category -- Sub Cat -- Sub Cat - Category -- Sub Cat -- Sub Cat

Therefore i would like my routes to be like so: http::/example.com/category/subcategory, and it can continue to nest further.

So my question is: from creating the nested structure and outputting it successfully, how do i know make the routing adopt my tree structure?

thanks

Tom Burman
  • 947
  • 3
  • 15
  • 37

1 Answers1

0

You can look how Symfony CMF or Sylius have solved this problem.

Symfony CMF has created a Router component with a Dynamic Router class.