1
我正在使用cakephp 1.26在本地主機中創建一個簡單的留言板。
當我想兩個表連接在一起,我得到這個錯誤:
未找到模型帖子的數據庫表帖子
Error: Database table posts for model post was not found.
下面是這兩個表的表結構:
表「後」有這些領域{帖子ID,主題,內容}
和表 '回覆' 具有這些字段{ReplyID,帖子ID,CreationDate}
這裏是模型site1.php的代碼:
<?php
class Site1 extends AppModel {
var $name = 'Site1';
var $useTable = 'post';
var $primaryKey = 'PostID';
var $hasMany = 'Reply';
}
?>
這裏是示範reply.php的代碼:
<?php
class Reply extends AppModel {
var $name = 'Reply';
var $useTable = 'reply';
var $primaryKey = 'ReplyID';
var $belongsTo ='post';
}
?>
你能幫我解決這個問題嗎?