title: Configure Symfony Route to match database fields
body: <p>I'm new to Symfony2 and am learning by making a concert finder application.</p>
  
  <p>Currently I have a couple of yaml routes:</p>
  
  <pre><code>london_hello_bands:
    path:     /hello/{band}
    defaults: { _controller: LondonHelloBundle:Hello:band }
  
  london_hello_multiple:
    path:     /hello/{venue}/{band}
    defaults: { _controller: LondonHelloBundle:Hello:more }
  </code></pre>
  
  <p>These are mapped to the following Actions within my HelloController:</p>
  
  <pre><code>public function bandAction($band)
  {
  $repository = $this-&gt;getDoctrine()
                -&gt;getRepository('LondonHelloBundle:Gig');
  
  $bandinfo = $repository-&gt;findByArtist($band);
  
      return $this-&gt;render(
          'LondonHelloBundle:Hello:band.html.twig',
          array('band'=&gt;$bandinfo)
          );
  }
  
  
  public function moreAction($venue, $band)
   {
    $repository = $this-&gt;getDoctrine()
                -&gt;getRepository('LondonHelloBundle:Gig');
    $venueinfo = $repository-&gt;findBy(
         array('venueName'=&gt;$venue, 'artist'=&gt;$band)
   );
  
       return $this-&gt;render(
        'LondonHelloBundle:Hello:venue.html.twig',
        array('venues'=&gt;$venueinfo)
        );
  }
  </code></pre>
  
  <p>This seems to all work fine and I can use Doctrine to pull out all the info about a band from the database at /hello/blur (for example) and I can show all the info about a particular band at a particular venue at hello/02/blur (for example - 02 is the name of an arena in the UK).</p>
  
  <p>However I also want to be able to show all the bands playing a particular venue at a URL like hello/02, however this conflicts with my first route:</p>
  
  <pre><code>path:     /hello/{band}
  </code></pre>
  
  <p>Is there a way I can associate a route with a particular field in the database (I was thinking maybe something like conditions <a href="https://symfony.com/doc/current/routing.html#matching-expressions" rel="nofollow noreferrer">https://symfony.com/doc/current/routing.html#matching-expressions</a>)? or do I just have to live with this and put some logic in the Twig template to handle things?</p>