title: How to retrieve Entity instance of an EntityType field inside a twig template in Symfony
body: <p>I am currently experiencing a problem with recovering the data I need, and I really hope that you will be able to help me. I am trying to create a form via the Symfony formbuilder to create an object that I call <code>Site</code>. This object contains users to fill in the form. To do so, I go through the Symfony entitytype to get my users from the database. I recover them well. However, I would like not to just display the name of each user to check but in addition to that to, i would like to display their data like address, telephone number etc in an HTML table with several columns. However I can't get my users objects recovered into my view with all their properties to pass. I can simply enter a label displaying several info that I can not put in a table. For information, users come from a many-to-many relationship. Do you have an idea to get all my users object across the view and not pass only a string to it? Here is my code: </p>
  
  <pre><code> $builder
              -&gt;add('name')
              -&gt;add('adress')
              -&gt;add('postalCode')
              -&gt;add('city')
              -&gt;add('phoneNumber')
              -&gt;add('observations')
              -&gt;add('country', EntityType::class, [
                  'class' =&gt; Country::class,
                  'choice_label' =&gt; 'name',
                  'by_reference' =&gt; false
              ])
              -&gt;add('devise', EntityType::class, [
                  'class' =&gt; Devise::class,
                  'choice_label' =&gt; 'symbol',
              ])
              -&gt;add('timezone', EntityType::class,[
                  'class' =&gt; TimeZone::class,
                  'choice_label' =&gt; 'name',
                  'by_reference' =&gt; false
              ])
              -&gt;add('users', EntityType::class ,
                  [
                      // looks for choices from this entity
                      'class' =&gt; User::class,
                      'choice_label' =&gt;  function (User $user) {
                          return $user-&gt;getFirstName() .' ' . $user-&gt;getLastName();
                      },
                      'choices' =&gt;  $this-&gt;userRepository-&gt;getUsersWithRoleBellowUserByCustomer($customer, $creator) ,
                      'multiple' =&gt; true,
                      'expanded' =&gt; true,
                      'by_reference' =&gt; false
                  ])
              -&gt;add('criterions',EntityType::class ,
                  [
                      // looks for choices from this entity
                      'class' =&gt; Criterion::class,
                      'choice_label' =&gt; 'name',
                      'multiple' =&gt; true,
                      'expanded' =&gt; true,
                      'by_reference' =&gt; false
                  ])
              -&gt;add('tags',EntityType::class ,
                  [
                      // looks for choices from this entity
                      'class' =&gt; Tag::class,
                      'choice_label' =&gt; 'name',
                      'multiple' =&gt; true,
                      'expanded' =&gt; true,
                      'by_reference' =&gt; false
                  ])
  </code></pre>
  
  <p>and I would like something like that in my view :</p>
  
  <pre><code>{{ form_start(form) }}
  
  
  
  &lt;table&gt;
      &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Name&lt;/td&gt;
          &lt;td&gt;Firstname&lt;/td&gt;
          &lt;td&gt;Adress&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
  
          {% for userField in form.users %}
              &lt;td&gt;
                  userField.name
                  userField.firstName
                  userField.adress
              &lt;/td&gt;
          {% endfor %}
      &lt;/tr&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  
      &lt;button class="btn"&gt;{{ button_label|default('Save') }}&lt;/button&gt;
  {{ form_end(form) }}
  </code></pre>
  
  <p>Here what i'm receiving when i make a dump of user.vars after making a foreach on form.users</p>
  
  <p><a href="https://i.stack.imgur.com/fi9k1.png" rel="nofollow noreferrer">https://i.stack.imgur.com/fi9k1.png</a></p>
  
  <p>Thank you for your help.</p>