在我的 RedpCategory 表中,我使用 cat_id 作为primaryKey,类似于下面的模型
在 RedpCategory 模型中:
<?php
App::uses('AppModel', 'Model');
class RedpCategory extends AppModel {
public $useTable = 'redp_category';
public $name = 'RedpCategory';
public $primaryKey = 'cat_id';
//
//
}
在我看来:
public function view($id = null) {
if (!$id) {
throw new NotFoundException(__('Invalid redeem category'));
}
$redp_categories = $this->RedpCategory->findById($id);
if (!$redp_categories) {
throw new NotFoundException(__('Invalid redeem category'));
}
$this->set('redp_categories', $redp_categories);
}
单击类别名称链接时出现错误:“未定义列:7 错误:列 RedpCategory.id 不存在”
我该如何解决这个问题?
任何答案将不胜感激。谢谢您。