title: Catch a dynamic URL from controller in Symfony 4
body: <p>I'm using Symfony 4 and the way to capture a route and direct it to a method of a controller is as follows:</p>
  
  <pre><code>/**
   * @Route("/my/route", name="name_of_route")
   */
  public function myMethod() {
      /* some logic that render a view */
  }
  </code></pre>
  
  <p>Within my application, I have a shopping cart. Let's suppose a hypothetical example where I have the following nesting of categories:</p>
  
  <pre><code>Solid
  └&gt;sand
    └&gt;refined sand
    └&gt;gross sand        
  ...etc...
  </code></pre>
  
  <p>if the user click on refined sand, I want to generate the follow URL:</p>
  
  <pre><code>www.myWeb.com/solid/sand/refined-sand
  </code></pre>
  
  <p>The problem is, how do I capture this URL with annotations since it is dynamic? That is, I can not do the following:</p>
  
  <pre><code>/**
   * @Route("/{category}/{subcategory}/{product}", name="name_of_route")
   */
  public function myMethod() {
      /* some logic that render a view */
  }
  </code></pre>
  
  <p>Because I do not know how many nesting levels the category has.</p>
  
  <p>I hope my question was understood. </p>