title: How can I create a URL in a Console Controller in ZF2?
body: <p>I have a Console Controller and an action to send emails (defined below in module.config.php)</p>
  
  <pre><code>'console' =&gt; array(
      'router' =&gt; array(
          'routes' =&gt; array(
              'cronroute' =&gt; array(
                  'options' =&gt; array(
                      'route'    =&gt; 'sendEmails',
                      'defaults' =&gt; array(
                          'controller' =&gt; 'Application\Controller\Console',
                          'action' =&gt; 'send-emails'
                      )
                  )
              ),              
          )
      )
  ),
  </code></pre>
  
  <p>In the action I want to send an email that contains a link to another action on the site. This would normally be done with a URL View Helper, but since the Request is of type Console and not HTTP, that doesn't work. I've tried to create an HTTP request, but I do not know how to give it the site domain or the Controller/Action link.</p>
  
  <p>My Controller code:</p>
  
  <pre><code>$vhm = $this-&gt;getServiceLocator()-&gt;get('viewhelpermanager');
  $url = $vhm-&gt;get('url');
  $urlString = $url('communication', array('action' =&gt; 'respond', 'id' =&gt; $id,
      array('force_canonical' =&gt; true));
  </code></pre>
  
  <p>This throws an error: </p>
  
  <pre><code>======================================================================
     The application has thrown an exception!
  ======================================================================
  Zend\Mvc\Router\Exception\RuntimeException
  Request URI has not been set
  </code></pre>
  
  <p>How do I create an HTTP Request in a Console Controller that has the site scheme, domain and path/to/action? And how do I pass it along to the URL View Helper?</p>