2013-04-05 34 views
0

因此,我使用代碼點火器的雄辯和獲得一些有趣的錯誤。雄辯無法找到代碼點火器模型

class Brand_model extends MY_Model { 


public function size() 
{ 
    return $this->hasOne('Size'); 
} 
} 

這行錯誤試圖加載我的尺寸模型時:

class Size extends MY_Model { 

    public function brand(){ 
     return $this->belongsTo('Brand'); 

    } 


} 

「無法找到班級規模」

任何想法?

+0

您是通過自動加載還是通過代碼加載類? – 2013-04-05 01:40:01

回答

0

你可以嘗試添加自動加載部分,您composer.json文件,喜歡這裏:http://snipr.it/~Dh

然後囤PHP composer.phar dumpautoload,它會加載模型從指定的目錄

在此之後,應班被發現。

其他選項只是做$ this-> load-> model('Brand_model'); $這 - >負載>模型( '尺寸');

試一試,希望它有幫助!

0

您需要確保您已將自動加載的作曲者加載到索引文件中。

CodeIgniter_with_Eloquent

最後的行前插入下面右邊的代碼在你的的index.php檢查出的全樣本:

require_once './vendor/autoload.php'; 

希望它幫助!