if (!empty($this->data)) {
$this->Category->create();
if ($this->Category->save($this->data)) {
$this->Session->setFlash(__('The category has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The category could not be saved. Please, try again.', true));
}
}
$parentCategories = $this->Category->ParentCategory->find('list');
$this->set(compact('parentCategories'));
此代码运行良好我在$parentCategories
中获取了类别名称,但在add函数中它没有在字段中获取数据