title: How do I retrieve a form collection's prototype attribute from within a controller (Symfony2)?
body: <p>I'm having trouble getting a form collection's prototype attribute within a controller for inclusion in a JSON response, the furthest I have got (i.e. no errors are being thrown) is with the following, however the returned value is empty.</p>
  
  <pre class="lang-php prettyprint-override"><code>$form      = $this-&gt;createForm(new MyType());
  $prototype = $form-&gt;get('myCollection')-&gt;getConfig()-&gt;getAttribute('prototype');
  </code></pre>
  
  <p>I've also tried creating the form's view, and pulling the attribute from there, however the <code>prototype</code> key is not defined here...</p>
  
  <pre class="lang-php prettyprint-override"><code>$form      = $this-&gt;createForm(new MyType());
  $view      = $form-&gt;createView();
  $prototype = $view-&gt;children['myCollection']-&gt;vars['attr']['prototype'];
  </code></pre>
  
  <p>Does anyone know where I'm going wrong?</p>
  
  <p>(Symfony 2.2.4)</p>