CakePHP 3.x 仅使用分页查找当前用户的记录

CakePHP 3.x Find records from current user only with paginate

这在 CakePHP 中似乎是一件非常简单的事情,但我找不到一个明确的例子。

我认为这适用于我的控制器:

public function index()
{
    $this->paginate = [
        'where' => ['user_id' => $this->Auth->user('id')],
        'contain' => ['Users']
    ];
    $slates = $this->paginate($this->Slates);

    $this->set(compact('slates'));
    $this->set('_serialize', ['slates']);
}

但我总能得到完整的 collection。我绝对登录了,我有两个独特的用户,我已经为他们每个人创建了记录。

更改条件。无法在文档中找到参考。

$this->paginate = [
        'conditions' => ['user_id' => $this->Auth->user('id')],
        'contain' => ['Users']
    ];