title: Zend Framework 2 - Segment Route
body: <p>I'm building an app using Zend Framework v2.2.0 and I'm creating different modules for each section.</p>
  
  <p>In a module, called <code>Company</code>, there is this route:</p>
  
  <pre><code>'company_wines' =&gt; array(
      'type' =&gt; 'Zend\Mvc\Router\Http\Segment',
      'options' =&gt; array(
          'route'    =&gt; '/:slug_company/:action/',
          'constraints'=&gt;array(
              ':slug_company'=&gt;'[a-zA-Z0-9\-_]+',
              ':action'=&gt;'(wines|red\-wines|white\-wines|sparkling\-wines|dessert\-wines|rose\-wines){1}',
          ),
          'defaults' =&gt; array(
              'controller' =&gt; 'Company\Controller\Company',
          ),
      ),
  ),
  </code></pre>
  
  <p>In another module, called <code>Vineyard</code>, I have this route:</p>
  
  <pre><code>'vineyard_page' =&gt; array(
      'type' =&gt; 'Zend\Mvc\Router\Http\Segment',
      'options' =&gt; array(
          'route'    =&gt; '/vineyard/:slug_vineyard/',
          'constraints'=&gt;array(
              ':slug_vineyard'=&gt;'[a-zA-Z0-9\-_]+',
          ),
          'defaults' =&gt; array(
              'controller' =&gt; 'Vineyard\Controller\Vineyard',
              'action'     =&gt; 'vineyard',
          ),
      ),
  ),
  </code></pre>
  
  <p>When I test with url <code>domain.ext/Company-name/red-wines/</code> or <code>domain.ext/Company-name/white-wines</code> etc, the <code>Company</code> controller is invoked.</p>
  
  <p>If I test with <code>domain.ext/vineyard/Vineyard-name/</code>, the <code>Vineyard</code> controller is not invoked, is still invoked the <code>Company</code> one and the error message say that the controller cannot dispatch the request. Off course there is no method called <code>VineyardnameAction()</code> in <code>CompanyController</code> class.</p>
  
  <p>I was expecting that the route match against the list of values specified on regex for <code>:action</code>, also if the <code>:slug_company</code> regex match the "flag" <code>vineyard</code>, then there is no action that match the <code>Vineyard-name</code> part...</p>
  
  <p>If I test the <code>:action</code> regex with <code>preg_match_all</code>, nothing is found in a string like <code>domain.ext/vineyard/Vineyard-name/</code>.</p>
  
  <p>If I disable <code>Company</code> module or delete the the <code>company_wines</code> route, <code>vineyard</code> route is working.</p>
  
  <p>I've solved creating different routes for each wines types, but I would like to understand whath I'm doing wrong :)</p>