-1
我想创建一个API来检索数据库中使用symfony2原则的字段,但查询总是返回未找到的结果。这是我尝试使用symfony教条检索数据库表中的字段
/**
* @Route("/get/{email}")
*/
public function emailAction($email)
{
$singleresult = $this->getDoctrine()->getRepository('Api3Bundle:Influ')->find($email);
if ($singleresult === null) {
return new View("user not found", Response::HTTP_NOT_FOUND);
}
请我怎么能修改上面的网址,以便在调用URI端点让它在参数返回的电子邮件。
请阅读[我该怎么办问一个好问题?](http://stackoverflow.com/help/how-to-ask)并相应地更新你的问题。 –
Try - > findOneBy(array('email'=> $ email))而不是 - > find($ email) –
Thanks Mathieu .... – Float