Twig : Get value of the entity attached to the form in twig view Symfony
<p>I would like to access to the values of the entity I attached to my form in my TWIG view.</p>

<p>The form is created this way :</p>

<pre><code>$form = $this-&gt;createForm(new SuperForm(), $entity);
</code></pre>

<p>In the twig view if I display the <code>{{ dump(form.vars.value) }}</code> I have this :</p>

<pre><code>Zone {#1000 ▼
#name: "First book zone"
 -book: Book {#538 ▶}
 -location: "inside"
 -priority: 5
 -live: true
 -BooksGroups: PersistentCollection {#1003 ▶}
 -hasGroups: true
 #slug: "sdds"
 #id: 2
 #createdAt: DateTime {#999 ▶}
 #updatedAt: null
 #owner: null
 #updateUser: null
}
</code></pre>

<p>EDIT: </p>

<p>However, when I try to access the value through this method, I can't :</p>

<pre><code>{{ form.vars.value.name }}

Impossible to access an attribute ("name") on a null   variable
</code></pre>

<p>The curious thing is that, when I do it with de default method, I have no problem and the real value is displayed :</p>

<pre><code>{{ form.vars.value.name|default('Default name') }}

Displayed: 'First book zone'
</code></pre>

<p>This is maybe a workaround for the strings and the integers, but how can I do for the Collections and the arrays ?</p>