【发布时间】:2011-03-27 22:50:37
【问题描述】:
我现在正在试用 CakePHP,但我的应用程序无法运行,因为 CakePHP “认为”我的模型名称是“Tach”,而实际上它是“Tache”。
为什么会这样?
我的控制器定义为: 应用程序/控制器/taches_controller.php
class TachesController extends AppController {
function index() {
$allTaches = $this->Tache->find('all');
$this->set('taches', $allTaches);
}
}
这是我的模型: 应用程序/模型/tache.php
class Tache extends AppModel {
var $useTable = 'taches';
}
如果我在控制器中使用“Tache”,我会收到错误:
$allTaches = $this->Tache->find('all');
但如果我使用“Tach”,我不会收到任何错误:
$allTaches = $this->Tach->find('all');
为什么我不能使用型号名称“Tache”?难道我做错了什么 ?顺便说一句,我在 php 5.3 上,我的 CakePHP 版本是 1.3.8
谢谢!
亚历克斯
【问题讨论】:
-
你使用的是什么版本的 CakePHP?
-
哦,对不起,我忘了。现在是 1.3.8。
-
您的 Taches 似乎成为某种自动去复数化的受害者。虽然我不知道 CakePHP..