title: Symfony twig get data value from collection object
body: <p><strong>Hello,</strong></p>
  
  <p>when editing a form with obj-values from a collection in Symfony 4.2, i need each collection-objects ID for frontend stuff.</p>
  
  <p>If I dump a collection object, </p>
  
  <pre><code>{{ dump(form.vars.data) }}
  </code></pre>
  
  <p>I can see something like this:</p>
  
  <pre><code>CollectionObj1 {#3341 ▼
    -id: 21167
    -value1: null
    -value2: 74
  </code></pre>
  
  <p>If I now want to access to the id with </p>
  
  <pre><code>{{ dump(form.vars.data.id) }}
  </code></pre>
  
  <p>I get the following error:</p>
  
  <blockquote>
    <p>Impossible to access an attribute ("id") on a null variable.</p>
  </blockquote>
  
  <p>Can somebody tell me, how I can access to the id of the object in the collection?</p>
  
  <p>Thanks very much in advance</p>