Cakephp - 间接修改重载属性CategoriesController :: $ Category无效

时间:2013-10-29 02:08:45

标签: cakephp-2.4

我有以下控制器类别:

App::uses('Folder', 'Utility');

class CategoriesController extends AppController {

public $components = array('Paginator');
public function index() {
    $this->Category->recursive = 0;
    $this->set('categories', $this->Paginator->paginate());
}

public function view($id = null) {
    if (!$this->Category->exists($id)) {
        throw new NotFoundException(__('Invalid category'));
    }
    $options = array('conditions' => array('Category.' . $this->Category->primaryKey => $id));
    $this->set('category', $this->Category->find('first', $options));
}

.......

我使用$uses

public $uses = array('Book', 'Chapter');

这些是我网站上发生的错误:

Notice (8): Indirect modification of overloaded property BooksController::$Book has no effect [APP\Controller\BooksController.php, line 26]
Warning (2): Creating default object from empty value [APP\Controller\BooksController.php, line 26]

// Line 26: $this->set('categories', $this->Paginator->paginate());

0 个答案:

没有答案