title: PHP iterate thru doctrine object inside array
body: <p>I have a doctrine array which holds an object, and that object contains properties, I'm trying to access each one but something doesn't work right.</p>
  
  <p>Here is the <code>print_r()</code> of <code>$users</code>:</p>
  
  <pre><code>Array ( 
      [0] =&gt; Entities\Months Object ( 
          [id:Entities\Months:private] =&gt; 12
          [month:Entities\Months:private] =&gt; December 
          [units:Entities\Months:private] =&gt; 1 
      ) 
  )
  </code></pre>
  
  <p>Here is the code:</p>
  
  <pre><code>$q = $this-&gt;doctrine-&gt;em-&gt;createQuery("select m from Entities\Months m where m.month = 'December'");
  $users = $q-&gt;getResult();
  print_r($users);
  foreach($users as $key =&gt; $value){
      echo $value-&gt;id:Entities\Months:private;
  }
  </code></pre>
  
  <p>This throws an error probably as the characters are messing up the property name. I tried this as well:</p>
  
  <pre><code>echo $value-&gt;{'id:Entities\Months:private'};
  </code></pre>
  
  <p>But says:</p>
  
  <pre><code>A PHP Error was encountered
  
  Severity: Notice
  
  Message: Undefined property: Entities\Months::$id:Entities\Months:private
  
  Filename: controllers/data.php
  
  Line Number: 264
  </code></pre>
  
  <p>So if anyone knows how to read these objects to manipulate them it would be appreciated.</p>