dqr3883 2019-01-28 09:45
浏览 49

如何将简单的mysql查询转换为doctrine查询语言?

Convert mysql Query to doctrine Query language ?

I have done the mysql and run the query in phpmyadmin and I'm getting returned rows :

select ppp.payperiod_sdesc,ppesa.gross_pay,pptpp.esi_employer_contribution,pptpp.pf_employer_contribution,pplw.employerContribution 
from py_process_emp_status_approved AS ppesa 
left join py_process_tds_pf_pt AS pptpp on ppesa.ou_code = pptpp.ou_code 
left join py_pay_group AS ppg on pptpp.pg_code = ppg.pg_code
left join py_process_labour_welfare AS pplw on ppg.pg_code = pplw.pg_code
left join py_pay_period AS ppp on pplw.payperiod_code = ppp.payperiod_code
left join py_payroll_calendar AS ppc on ppp.paycal_code = ppc.paycal_code
WHERE ppesa.ou_code = 15000 
ORDER BY ppesa.ou_code DESC 
LIMIT 0,5

please convert the mysql query to doctrine Query language.

  • 写回答

1条回答 默认 最新

  • doukang7486 2019-01-28 15:21
    关注

    You may be able to find more guidance in the docs here: https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/native-sql.html

    Have a look at result set mapping. You can also just create a repository function to execute native sql and then call your repo function.

    You can then call something like this below: results = getDoctrine()->getManager()->getRepository(Your repo)->repofunction();

    If your unsure how to create / call a repository function its covered multiple times in the symfony docs.

    Doctrine loads all results then filters down, this is an expensive process you may be best letting sql do the work for you.

    Hopefully you have everything you need to get to your end result.

    评论

报告相同问题?

悬赏问题

  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)