title: ZF2 - Generating Url from route
body: <p>I can't figure out to generate Url from everywhere i want to, in zend 2</p>
  
  <p>I get action and controller so i try this:</p>
  
  <pre><code>$this-&gt;url('myControllerName', array('action' =&gt; 'myActionName'));
  </code></pre>
  
  <p>But this return an object, i just want the full URL string of this route</p>
  
  <p>Somebody can help me to find the proper way? </p>
  
  <p>EDIT : according to Stoyan, maybe i made a mistake on my route. here is the part of my module.config</p>
  
  <pre><code>'router' =&gt; array (
                  'routes' =&gt; array (
                          'indexqvm' =&gt; array (
                                  'type' =&gt; 'segment',
                                  'options' =&gt; array (
                                          'route' =&gt; '/Indexqvm[/:action][/:id_event]',
                                      'constraints' =&gt; array (
                                              'action' =&gt; '[a-zA-Z][a-zA-Z0-9_-]+',
                                              'id_event' =&gt; '[0-9]+'
                                      ),
                                      'defaults' =&gt; array (
                                              'controller' =&gt; 'Qvm\Controller\Indexqvm',
                                              'action' =&gt; 'index' 
                                      ) 
                              ) 
                      ),
  </code></pre>
  
  <p>And my call :</p>
  
  <pre><code>echo $this-&gt;url('indexqvm', array('action' =&gt; 'list-index'));
  </code></pre>
  
  <p>the error : 
      Catchable fatal error: Object of class Zend\Mvc\Controller\Plugin\Url could not be converted to string</p>