1
有了:找到第三个层次递归
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid Post', true));
$this->redirect(array('action' => 'index'));
}
$this->set('post', $this->Post->read(null, $id));
}
我能找到相关的用户,但用户有档案。
当我列出相关用户,我想有个人资料的电子邮件,而不是PROFILE_ID
Post $hasAndBelongsToMany Users $belongsTo Profile.
表:
用户
Posts_Users
帖子
配置文件。
答:
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid Post', true));
$this->redirect(array('action' => 'index'));
}
$this->Post->recursive =2;
$this->set('post', $this->Post->read(null, $id));
}