【发布时间】:2017-07-28 05:21:56
【问题描述】:
$table = TableRegistry::get('Leads');
$query = $table->find('all')->leftJoinWith('LeadStatus')->contain(['Users', 'LeadStatus' =>
function ($q)
{
return $q->contain(['LeadBuckets', 'LeadBucketSubStatus'])->where(['LeadStatus.is_active' => 1]);
}
])->where(['Leads.sub_agent_id' => $subAgentId]);
这是我的查询,我在表 leads 中使用表 lead_status 的左连接。现在,我还想在同一个查询中对第三个表assigned_leads 使用左连接。
我已尝试将连接表 leads 和 lead_status 与 assigned_leads 关联。我正在使用 cakephp 3.x 我该如何实现呢?
【问题讨论】:
标签: php mysql cakephp cakephp-3.x