php - 用于多连接表的 Active Record 或 DataMapper
问题描述
目前我正在寻找在 php 中重构我的代码以使用 Active Record 或 DataMapper。我有一个复杂的 sql 查询,其中一个表是基础,我将多个表连接到多个级别,即加入另一个表连接到的表。
例如:
Select <list of columns>
from main_table
left join table1
left join table2 as t1
left join table2 as t2
left join table3
left join table4 on table3.key = table4.key
left join ( select * from table5 ) as t3
left join ( select * from table6 where id in ( select id from table7 ) ) as t4
where <conditions>
用什么比较好?活动记录或数据映射器。此外,我希望它可以方便地升级或插入到主表中。并且还做一些显示/输出功能。处理来自用户的输入。
欢迎任何建议。
解决方案
推荐阅读
- java - 在同一字符串的不同部分使用替换
- redux - How to integrate Redux DevTools with ReactOnRails
- julia - Closure, anonymous function, why not being the values when they were created
- docker - 使用 Dockerfile 安装的依赖项在后续管道步骤中无法访问。如何启用?
- json - 如何使用 Circe 将空对象插入 JSON?
- c++ - libc++ 的 std::is_literal_type 是如何工作的?
- tensorflow - Tensorflow: Modify datapoints used in loss function evaluation after each gradient step using tf optimizer
- angular - How to use gzipper package in angular 7?
- javascript - 如何在不使用 ajax 硬刷新的情况下多次发出请求
- python - 生成字符串列表的所有排列