简体   繁体   English

如何使用cakephp的分页方法进行联接?

[英]How can I do a JOIN using cakephp's paginate method?

I have two tables that look like following: 我有两个表,如下所示:

RELEASE TABLE
name
asin


MATCHES TABLE
date
asin

I want to show a paginated page that shows all the RELEASES that have MATCHES. 我想显示一个分页显示所有具有MATCHES的RELEASES。 That is the asin column in RELEASE needs to match the asin column in MATCHES. 那就是RELEASE中的asin列需要与MATCHES中的asin列匹配。

How would I do that using the paginate method assuming I have all the models included in my controller? 假设我已将所有模型包含在控制器中,该如何使用分页方法执行此操作?

$this->paginate = array(
    'conditions' => array('not' => array('Release.match_id' => null))
);
$data = $this->paginate('Release');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM