title: Zend Framework - Controller - HeadScript - Not Loading After `composer update`
body: <p>I am quite new to Zend Framework (2). I have been developing a mini ERP as a project and every thing seemed to be good.</p>
  
  <p>But this morning, I wanted to install PHPUnit, I updated the composer.json file and ran <code>composer install</code> but it saind <code>nothing to install</code>. Then after some brief searches, I noted that I should be running <code>composer update</code> instead. It did update <code>Zend Framework</code> to <code>2.2.0</code> and some others. Zend used to be <code>2.0.8</code>.</p>
  
  <p>I ran the applicaiton, it all looked good, until my partner complained a demo failed.</p>
  
  <p>I diagnosed the problem, which was caused by not loading JavaScript files. The required JavaScripts for the view were given through the controller as follows.</p>
  
  <pre><code>public function viewContactAction(){
      // Get the user id from url
      $id = $this-&gt;params()-&gt;fromRoute('id');
  
      $this-&gt;headScript = new HeadScript();
      $this-&gt;headScript-&gt;appendFile('../../js/pages/lib/contact.view.js');
      $this-&gt;headScript-&gt;appendFile('../../js/packages/json-populate/dist/jquery.jsonPopulate.min.js');
  
      $view = new ViewModel(array('title' =&gt; 'Contact View', 'contact_id' =&gt; $id));
      $view-&gt;setTemplate('contacts/contacts/contact');
  
      return $view;
      //die("User View for $id");
  }
  </code></pre>
  
  <p>Then I looked in to the Layout file under the <code>Application</code> <code>model</code>. It seemed to be using some thing different. And I updated it as follows.</p>
  
  <pre><code>public function viewContactAction(){
      // Get the user id from url
      $id = $this-&gt;params()-&gt;fromRoute('id');
  
      //$this-&gt;headScript = new HeadScript();
      $this-&gt;headScript()-&gt;appendFile('../../js/pages/lib/contact.view.js');
      $this-&gt;headScript()-&gt;appendFile('../../js/packages/json-populate/dist/jquery.jsonPopulate.min.js');
  
      $view = new ViewModel(array('title' =&gt; 'Contact View', 'contact_id' =&gt; $id));
      $view-&gt;setTemplate('contacts/contacts/contact');
  
      return $view;
      //die("User View for $id");
  }
  </code></pre>
  
  <p>Thinking it would be some thing like a file-not-found issue, I changed the file paths as if it was in the public folder <code>/js/pages/lib/contact.view.js</code>, but still the files don't show up.</p>
  
  <p>Is using HeadScript in the controller no longer supported? Or has the way changed? Thanks in advance.</p>
  
  <p>ok, this is my layout file. I don't remember making any changes to it except add some js.</p>
  
  <pre><code>&lt;?php echo $this-&gt;doctype(); ?&gt;
  
  &lt;html lang="en"&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;?php echo $this-&gt;headTitle('ZF2 '. $this-&gt;translate('Skeleton Application'))-&gt;setSeparator(' - ')-&gt;setAutoEscape(false) ?&gt;
  
          &lt;?php echo $this-&gt;headMeta()-&gt;appendName('viewport', 'width=device-width, initial-scale=1.0') ?&gt;
  
          &lt;!-- Le styles --&gt;
          &lt;?php echo $this-&gt;headLink(array('rel' =&gt; 'shortcut icon', 'type' =&gt; 'image/vnd.microsoft.icon', 'href' =&gt; $this-&gt;basePath() . '/images/favicon.ico'))
                          -&gt;prependStylesheet($this-&gt;basePath() . '/css/bootstrap-responsive.min.css')
                          -&gt;prependStylesheet($this-&gt;basePath() . '/css/style.css')
                          -&gt;prependStylesheet($this-&gt;basePath() . '/css/bootstrap.min.css') ?&gt;
  
          &lt;!-- Scripts --&gt;
  
          &lt;?php echo $this-&gt;headScript()-&gt;prependFile($this-&gt;basePath() . '/js/html5.js', 'text/javascript', array('conditional' =&gt; 'lt IE 9',))
                                        -&gt;prependFile($this-&gt;basePath() . '/js/bootstrap.min.js')
                                        -&gt;prependFile($this-&gt;basePath() . '/js/jquery.min.js')
                                        -&gt;appendFile($this-&gt;basePath() . '/js/jquery.konnections.tableDefinition.js')
                                        -&gt;appendFile($this-&gt;basePath() . '/js/jquery.konnections.appendTemplateFromJSON.js'); ?&gt;
          &lt;?php //echo $this-&gt;headScript; ?&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div class="navbar navbar-inverse navbar-fixed-top"&gt;
              &lt;div class="navbar-inner"&gt;
                  &lt;div class="container"&gt;
                      &lt;a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"&gt;
                          &lt;span class="icon-bar"&gt;&lt;/span&gt;
                          &lt;span class="icon-bar"&gt;&lt;/span&gt;
                          &lt;span class="icon-bar"&gt;&lt;/span&gt;
                      &lt;/a&gt;
                      &lt;a class="brand" href="&lt;?php echo $this-&gt;url('home') ?&gt;"&gt;&lt;?php echo $this-&gt;translate('Skeleton Application') ?&gt;&lt;/a&gt;
                      &lt;div class="nav-collapse collapse"&gt;
                          &lt;ul class="nav"&gt;
                              &lt;li class="active"&gt;&lt;a href="&lt;?php echo $this-&gt;url('home') ?&gt;"&gt;&lt;?php echo $this-&gt;translate('Home') ?&gt;&lt;/a&gt;&lt;/li&gt;
                              &lt;li class="dropdown"&gt;
                                  &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown"&gt;
                                      &lt;?php echo $this-&gt;translate('Contacts'); ?&gt;
                                  &lt;/a&gt;
                                  &lt;ul class="dropdown-menu"&gt;
                                      &lt;li&gt;&lt;a href='contacts'&gt;Contact Table&lt;/a&gt;&lt;/li&gt;
                                      &lt;li&gt;&lt;a href='contacts/add-contact'&gt;Add New Contact&lt;/a&gt;&lt;/li&gt;
                                  &lt;/ul&gt;
                              &lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/div&gt;&lt;!--/.nav-collapse --&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="container"&gt;
              &lt;?php echo $this-&gt;content; ?&gt;
              &lt;hr&gt;
              &lt;footer&gt;
                  &lt;p&gt;&amp;copy; 2005 - 2012 by Zend Technologies Ltd. &lt;?php echo $this-&gt;translate('All rights reserved.') ?&gt;&lt;/p&gt;
              &lt;/footer&gt;
          &lt;/div&gt; &lt;!-- /container --&gt;
          &lt;?php echo $this-&gt;inlineScript() ?&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The Generated source looks like this (page is kinda very long, so only the header i sincluded).</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;title&gt;ZF2 Skeleton Application&lt;/title&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
          &lt;!-- Le styles --&gt;
          &lt;link href="/css/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css"&gt;
  &lt;link href="/css/style.css" media="screen" rel="stylesheet" type="text/css"&gt;
  &lt;link href="/css/bootstrap-responsive.min.css" media="screen" rel="stylesheet" type="text/css"&gt;
  &lt;link href="/images/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon"&gt;
          &lt;!-- Scripts --&gt;
  
          &lt;script type="text/javascript" src="/js/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/js/bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;!--[if lt IE 9]&gt;&lt;script type="text/javascript" src="/js/html5.js"&gt;&lt;/script&gt;&lt;![endif]--&gt;
  &lt;script type="text/javascript" src="/js/jquery.konnections.tableDefinition.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/js/jquery.konnections.appendTemplateFromJSON.js"&gt;&lt;/script&gt;            &lt;/head&gt;
  </code></pre>