2013-02-24 123 views
0

我嘗試瞭解決這個問題的所有建議解決方案,即清除緩存文件夾。我也禁用了緩存Configure::write('Cache.disable', true);我的調試級別設置爲2.但是我總是得到一個相同的錯誤。缺少的表只是新添加的表。順便說一句,我只在我的本地主機上運行。 這是我的型號命名Department.phpCakePHP返回丟失的數據庫表

<?php 

class Department extends AppModel { 

    public $name = 'Department'; 
} 
?> 

,這是我的控制器名稱DepartmentsController.php

<?php 
class DepartmentsController extends AppController { 

     public $name = 'Departments'; 
    public $helpers = array('Html', 'Form','Session'); 
    public $components = array('RequestHandler','Session'); 


    function index() { 
     $this->Department->recursive = 0; 
     $this->set('departments', $this->paginate()); 
    }  
} 
?> 

提前感謝您的回答! :d

+0

cakephp說缺少什麼表?你可以在你的問題中包含實際的錯誤信息嗎?此外,$ name屬性可能不在您的Controller中,只在您的Model中,但我不認爲這與您的問題有關 – thaJeztah 2013-02-26 00:03:37

回答

0

假設你實際上是使用一個數據庫我想嘗試以下操作:

  1. 如果你的數據庫表中未使用CakePHP的約定命名,手動設置:

    公共$ useTable ='table_name';

  2. 確保數據庫配置,那麼在應用程序中使用正確的數據庫/配置/ database.php中

  3. 如果該模型是一個插件,使用包括它的控制器時,插件語法:

    public $ uses = array('PluginName.Department');