【发布时间】:2017-11-14 01:01:48
【问题描述】:
您好,我有一个问题,我想在 Symfony 中从我的实体中检索数据,代码如下:
public function indexAction(Request $request , $id)
{
$getDoctrine = $this->getDoctrine()->getManager();
$email = $getDoctrine->getRepository('desplayBundle:people')->find($id);
dump($email);
return $this->render('emailBundle:Default:index.html.twig', array());
}
我想在我的控制器中而不是在树枝中检索数据。
【问题讨论】:
-
你用 dump($email) 检索什么?你的预期输出是什么?
-
我从我提供的那个 id 的实体中检索该行中的所有内容,但我只想从该列中提取电子邮件
-
@erevos13 你在模型中定义了getter和setter吗?
-
你的实体有 getter 和 setter 吗?喜欢:
public function getEmail()in 你的People实体? -
你尝试了什么,有什么问题?有什么错误吗?