title: Variable as name of row in TWIG : Symfony 2
body: <p>I have a problem in my Symfony2 application. In Controller I'm getting an array of facebook users and posting it to my form class, where I create some checkboxes. In my template I need to print theese checkboxes as pictures of these users. I try to print it like this : {{form_row(form.{{girl.id}})}}, but TWIG template doesn't allow to use variable {{girl.id}} as name of row and also I don't know how print theese checkboxes as pictures. Can anyone help me with this ? </p>
  
  <p>This is ma Controller action</p>
  
  <pre><code>public function indexAction()
      {
  
          $facebook = $this-&gt;get('facebook');
          $friends = $facebook-&gt;api('me/friends?fields=id,name,gender');
  
          $friends = $friends['data'];
          foreach($friends as $friend){
  
              if(array_key_exists('gender',$friend))
              {
              if($friend['gender'] =='female')
                  $girls[]=$friend;
              }
              }
              for ($i=0; $i &lt;5; $i++) { 
                  $default[]=$girls[$i];
              }
          $formular = new FriendsForm();
          $formular-&gt;addFriend($default);
  
          $form = $this-&gt;createForm($formular);
  
  
  
  
          return array('girls'=&gt;$default,'form' =&gt; $form-&gt;createView());
      }
  </code></pre>
  
  <p>This is my Form class</p>
  
  <pre><code>class FriendsForm extends AbstractType
  {
      private $friends;
  
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $friends = $this-&gt;friends;
  
          foreach($friends as $friend)
          {
              $builder
              -&gt;add($friend['id'],'checkbox',array('label' =&gt; false,'required'=&gt;false, 'value'=&gt;$friend['']));
          ;    
          }
  
      }
  
  
      public function getName()
      {
          return '';
  
      }
  
       public function addFriend($data)
      {
          $this-&gt;friends = $data;
      }
  
  }
  </code></pre>
  
  <p>This is my template</p>
  
  <pre><code>&lt;p&gt;
  {%if girls is defined%}
  {{form_start(form)}}
  {%for girl in girls%}
  {{form.row(form.{{girl.id}})}}
  {%endfor%}
  {{form_end(form)}}
  {%endif%}
  &lt;/p&gt;
  </code></pre>