我想在这里理解的是,这个错误是什么意思,我做错了什么?我一定是搞砸了命名约定。
我的模型是产品和类别。类别有hasMany,产品有belongsTo。
http://webdesign4.georgianc.on.ca/~100141468/comp2084/todo/products/add
http://webdesign4.georgianc.on.ca/~100141468/comp2084/todo/products/filter/9
名字y
通过 y
产品控制器
function filter($category_id) {
$this->set('Product',$this->Product->findAllByCategoryId($category_id));
}
添加
$this->loadModel('Category');
$this->set('Categorys',$this->Category->find('list',array('order'=> array('Category.name'))));
过滤器.ctp
<? foreach($Product as $row): ?>
<tr><td>
<?=$row['Product']['id']?>
</td><td>
<?=$row['Product']['name']?>
</td><td>
<?=$row['Product']['price']?>
</td><td>
<?=$row['Category']['name']?>
</td><td>
<a href="edit/<?=$row['Product']['id']?>">Edit</a>
</td></tr>
<? endforeach; ?>
添加.ctp
<?php
echo $this ->Form->input('name');
echo $this ->Form->input('description');
echo $this ->Form->input('price');
echo $this ->Form->input('file', array('type' => 'file'));
echo $this ->Form->input('Category_id');
echo $this ->Form->end('submit',true);
?>