add new function attachDefaultListener() in FileUpload Service and change import function in Reference Service
This commit is contained in:
parent
b113f19dce
commit
23f3a7828c
|
@ -39,9 +39,6 @@ class Upload extends AbstractEventManager implements ServiceManagerAwareInterfac
|
|||
|
||||
public function init()
|
||||
{
|
||||
$Listener = new DefaultFileUploadListener;
|
||||
$this->getEventManager()->attachAggregate($Listener);
|
||||
|
||||
$configService = $this->serviceManager->get('ConfigService');
|
||||
$this->config = $configService->get('file.php');
|
||||
}
|
||||
|
@ -51,6 +48,15 @@ class Upload extends AbstractEventManager implements ServiceManagerAwareInterfac
|
|||
return $this->upload($files,$rootDir,$childDir,$fileName,$dateDirModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加默认侦听器,会将信息保存到Attachments数据表
|
||||
*/
|
||||
public function attachDefaultListener()
|
||||
{
|
||||
$Listener = new DefaultFileUploadListener;
|
||||
$this->getEventManager()->attachAggregate($Listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param $files 上传文件的信息 e.g.$_FILE['fileData']
|
||||
|
|
|
@ -97,6 +97,7 @@ class Reference extends AbstractEventManager implements ServiceManagerAwareInter
|
|||
$appConfig = $configService->get('application.ini');
|
||||
|
||||
$fileUploadService = $this->serviceManager->get('File/Upload');
|
||||
$fileUploadService->attachDefaultListener();
|
||||
$fileUploadService->setParams(['file_type' => 'literature']);
|
||||
$file_info = $fileUploadService($file,$appConfig['reference_save_path'],"","",$fileUploadService::DATETIME_MODEL_Y);
|
||||
|
||||
|
|
Loading…
Reference in New Issue