0
我試圖更新我的Cake 1.3應用程序到2.0。在某些型號的方法我加載Session和電子郵件組件是這樣的:Cakephp 1.3到2.0的轉換
App::uses('SessionComponent', 'Controller/Component');
App::uses('EmailComponent', 'Controller/Component');
$Session = new SessionComponent();
$Email = new EmailComponent();
然而,當我打開這些網頁我得到這個錯誤:
Warning (4096): Argument 1 passed to Component::__construct() must be an instance of ComponentCollection, none given, called in /Users/username/Sites/cake2app/app/Model/User.php on line 183 and defined [CORE/Cake/Controller/Component.php, line 77]
Notice (8): Undefined variable: collection [CORE/Cake/Controller/Component.php, line 78]
什麼是加載正確的方式在Cake 2.0中使用組件,就像我們可以使用Cake 1.3一樣?
請注意,CakePHP 2.0剛剛出來。除非您需要升級的原因,否則我建議等待。如果你必須,你的答案可以在[遷移指南]中找到(http://book.cakephp.org/2.0/en/appendices/2-0-migration-guide.html) –
這似乎是對於那些一直在測試Beta和RC的人來說這是一個常見問題。我幾乎只是在2.0中重寫了一個傾斜的1.3應用程序,沒有明確的時間表。 –