donglinyi4313 2017-06-12 14:01
浏览 67
已采纳

symfony从实体中提取数据

Hello i have a problem i would like to retrieve data from my entity in Symfony here is the code:

  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());
    }

I would like to retrieve the data inside my controller and not in twig.

  • 写回答

2条回答 默认 最新

  • duanliusong6395 2017-06-12 14:12
    关注

    You want to get email from user ?

    public function indexAction(Request $request , $id)
    {
    
        $getDoctrine = $this->getDoctrine()->getManager();
    
        $user = $getDoctrine->getRepository('desplayBundle:people')->find($id);
        $email = $user->getEmail();
    
        return $this->render('emailBundle:Default:index.html.twig', array());
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 VFP如何使用阿里TTS实现文字转语音?
  • ¥100 需要跳转番茄畅听app的adb命令
  • ¥50 寻找一位有逆向游戏盾sdk 应用程序经验的技术
  • ¥15 请问有用MZmine处理 “Waters SYNAPT G2-Si QTOF质谱仪在MSE模式下采集的非靶向数据” 的分析教程吗
  • ¥50 opencv4nodejs 如何安装
  • ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
  • ¥15 nginx反向代理获取ip,java获取真实ip
  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
  • ¥15 376.1电表主站通信协议下发指令全被否认问题