title: cakephp 3 url in controller
body: <p>I have to send url from controller to view with json..It not ok when i use $this->Html->link or $this->Url->build for link. How can i send link to json..</p>
  
  <p>use Cake\View\Helper\UrlHelper;  at top</p>
  
  <pre><code>foreach($schedules as $s) :
              $start=$s-&gt;start_at;
              $end=$s-&gt;finished_at;
  
     $link= $this-&gt;Url-&gt;build([ 
                                      'controller' =&gt; 'Bookings','action' =&gt; 'makebooking',
                                      'comid' =&gt; 1,
                                      'comslug' =&gt;'Moe Moe',
                                      'sevid'=&gt;2,
                                      'sevslug'=&gt;'face washing',
                                      'sid'=&gt;$s-&gt;id,
                                      'start'=&gt;$start,
                                      'end'=&gt;$end
                                      ]); 
              $out[]=array(
                  'id'=&gt;$s-&gt;id,
                  'title'=&gt;'( '.$s-&gt;start_at.'-'.$s-&gt;finished_at.' )'.$s-&gt;name,
                  'url'=&gt;$link,
                  'start'=&gt;strtotime($s-&gt;start_at).'000',
                  'class'=&gt;'event-important'
  
                  );
           endforeach;
  
  
           echo json_encode(array('success'=&gt;1,'result'=&gt;$out));exit;
  </code></pre>
  
  <p>Error: Call to a member function build() on a non-object 
  and i was</p>