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完成工作。 –