title: Symfony forms : Collect array of data
body: <p>I need to collect array of data via input fields. For example:</p>
  
  <pre><code>&lt;input name="customer_name" type="text"&gt;
  &lt;input name="customer_emails[]" type="text"&gt;
  &lt;input name="customer_emails[]" type="text"&gt;
  &lt;input name="customer_emails[]" type="text"&gt;
  </code></pre>
  
  <p>How to render this type of form in Symfony2 form builder?</p>
  
  <p>Documentation says:</p>
  
  <pre><code>$builder-&gt;add('emails', 'collection', array(
      // each item in the array will be an "email" field
      'type'   =&gt; 'email',
      // these options are passed to each "email" type
      'options'  =&gt; array(
          'required'  =&gt; false,
          'attr'      =&gt; array('class' =&gt; 'email-box')
      ),
  ));
  </code></pre>
  
  <p>It is not clear to me where I should provide the number of email fields I want.</p>