コントローラに$idがあります。これは外部キーです。
$query = $em->getRepository('SurgeryPatientBundle:Patients')->findPatientByUserID($id);
そして私のリポジトリファイルでは、この関数
public function findPatientByUserID($id)
{
return $this->getEntityManager()
->createQuery('SELECT p FROM SurgeryPatientBundle:Patients p WHERE p.user ='.$id.'')
->execute();
}
オブジェクトのインスタンスを取得したいのですが、それでも配列を取得します。find($ id)を使用したクエリは適切に機能します
編集問題は解決します、私はとても愚かです、私は$query[0]を呼び出しました