0
我試圖運行一個Symfony任務,但是當我嘗試實例化一個類時,我得到一個致命錯誤。Symfony 1.4任務無法訪問類
類位於
- 應用
- MyApp的
- LIB
- MyApp的
我的代碼如下
protected function execute($arguments = array(), $options = array())
{
$this->reloadAutoload();
// initialize the database connection
$databaseManager = new sfDatabaseManager($this->configuration);
$connection = $databaseManager->getDatabase($options['connection'])->getConnection();
// Get file from dir
if(!in_array($arguments['filename'] . $this->fileExt, scandir($this->path))) {
$this->logSection('Import CSV', 'File doesn\'t exist.', null, 'ERROR');
return;
}
$path = $this->path . '/' . $arguments['filename'] . $this->fileExt;
if(class_exists('CsvReader')) {
$csvReader = new CsvReader($path);
} else {
$this->logSection('Import CSV', 'Class doesn\'t exist.', null, 'ERROR');
return;
}
// add your code here
$this->logSection('Import CSV', 'All content imported.');
}
如果有什麼我失蹤然後讓我知道,我會修改我的問題。
謝謝。
凱文您好,感謝您的回覆。我完成了這兩個,它仍然無法實例化。我剛剛採用舊的skool方式,只是使用require_once完成工作。 –