title: Symfony/Doctrine: fetching data as object , still get array
body: <p>I have in my controller $id it's a foreign key</p>
  
  <pre><code>  $query = $em-&gt;getRepository('SurgeryPatientBundle:Patients')-&gt;findPatientByUserID($id);
  </code></pre>
  
  <p>And in my repository file this function</p>
  
  <pre><code> public function findPatientByUserID($id)
  {
  
      return $this-&gt;getEntityManager()
          -&gt;createQuery('SELECT p FROM SurgeryPatientBundle:Patients p WHERE p.user ='.$id.'')
          -&gt;execute();
  
  }
  </code></pre>
  
  <p>I want get an instance of object but still get an array. Query with find($id) works good</p>
  
  <p>edit 
  Problem solves , I'm so stupid , I had invoked to $query[0] </p>