title: Symfony2 Form Component - creating fields without the forms name in the name attribute
body: <p>I'm currently trying to use the Symfony2 Form Component though the Silex microframework.</p>
  
  <p>My login form is generated as follows:</p>
  
  <pre><code>$app = $this-&gt;app;
  
  $constraint = new Assert\Collection(array(
      'username' =&gt; new Assert\NotBlank(),
      'password' =&gt; new Assert\NotBlank(),
  ));
  
  $builder = $app['form.factory']-&gt;createBuilder('form', $data, array('validation_constraint' =&gt; $constraint));
  
  $form = $builder
      -&gt;add('username', 'text', array('label' =&gt; 'Username'))
      -&gt;add('password', 'password', array('label' =&gt; 'Password'))
      -&gt;getForm()
  ;
  
  return $form;
  </code></pre>
  
  <p>The issue is that the resulting form is being created as follows:</p>
  
  <pre><code>&lt;fieldset&gt;
      &lt;input type="hidden" value="******" name="form[_token]" id="form__token"&gt;
      &lt;section class=""&gt;
          &lt;label class=" required" for="form_username"&gt;Username&lt;/label&gt;
          &lt;div&gt;&lt;input type="text" value="" name="form[username]" id="form_username" class="text"&gt;&lt;/div&gt;
      &lt;/section&gt;
      &lt;section class=""&gt;
          &lt;label class=" required" for="form_password"&gt;Password&lt;/label&gt;
          &lt;div&gt;&lt;input type="password" value="" name="form[password]" id="form_password" class="password"&gt;&lt;/div&gt;
      &lt;/section&gt;
      &lt;section&gt;
          &lt;div&gt;&lt;button class="fr submit"&gt;Login&lt;/button&gt;&lt;/div&gt;
      &lt;/section&gt;
  &lt;/fieldset&gt;
  </code></pre>
  
  <p>Whereas I want the name and id attributes to be as follows:</p>
  
  <pre><code>&lt;div&gt;&lt;input type="text" value="" name="username" id="username" class="text"&gt;&lt;/div&gt;
  ...
  &lt;div&gt;&lt;input type="password" value="" name="password" id="password" class="password"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I've scoured the web and discovered advice on the 'property_path' option but I believe this is to do with the class used to process the data when used in the actual Symfony2 framework itself.</p>
  
  <p>I've been through the Form Component files and the point as which this is being set is in:</p>
  
  <p>Symfony/Component/Form/Extension/Core/Type/FieldType.php - line 71</p>
  
  <pre><code>public function buildView(FormView $view, FormInterface $form)
  {
      $name = $form-&gt;getName();
  
      if ($view-&gt;hasParent()) {
          $parentId = $view-&gt;getParent()-&gt;get('id');
          $parentFullName = $view-&gt;getParent()-&gt;get('full_name');
          $id = sprintf('%s_%s', $parentId, $name);
          $fullName = sprintf('%s[%s]', $parentFullName, $name);
      } else {
          $id = $name;
          $fullName = $name;
      }
      ...
  </code></pre>
  
  <p>Unforunately the FormFactory utilises the FormBuilder which then works with the Form class and I've not had enough time to analyse the whole inner workings of the Component.</p>
  
  <p>I do know that fields are added into the 'children' array within the FormBuilder with a corresponding list of options. When the getForm function is called, a new Form is instantiated and each child FieldType is entered into the Form using the add() method. This Form->add() method automatically sets the Form as the parent of each child:</p>
  
  <pre><code>public function add(FormInterface $child)
  {
      $this-&gt;children[$child-&gt;getName()] = $child;
  
      $child-&gt;setParent($this);
  
      if ($this-&gt;dataMapper) {
          $this-&gt;dataMapper-&gt;mapDataToForm($this-&gt;getClientData(), $child);
      }
  
      return $this;
  }
  </code></pre>
  
  <p>Without starting to override these classes just to remove this does anyone else know of the best method of just displaying the fields name?</p>
  
  <p>It is possible to just pull 'name' instead of 'full_name' in the form_div_layout.html.twig widget_attributes block but I wasn't sure as to whether this was ideal (as the id remains unchanged) or if there was another method or injectable options that would do the trick.</p>