错误:CakePHP 1.3导入组件到shell

时间:2012-08-17 03:58:33

标签: shell cakephp cron cakephp-1.3

您好我正在尝试将组件导入shell,这是我的代码

<?php
App::import('Component', 'OptimalPayment');

class PushEftShell extends Shell {
    var $uses = array('User' , 'Payment');

    function main() {
        $OptimalPayment = OptimalPaymentComponent();
        $Organsation = $this->Organisation->find('all', array(
            'fields' => array('id', 'name'),
            'contain' => array(
                'ContactPerson', 'BankDetail', 'Address', 'Phone'
            )
        ));
    }
}
?>

并且我有这个错误消息

Fatal error: Class 'Component' not found in C:\web\appName\app\controllers\components\optimal_payment.php on line 24

我的导入有什么问题?

TIA

1 个答案:

答案 0 :(得分:1)

在CakePHP 1.3中,您应该按Object扩展组件类。这意味着你应该写如下:

class OptimalPaymentComponent extends Object{
.............
}