我正在尝试为新创建的用户添加新的文件安装。是否可以使用Typo3的Datahandler?我尝试了以下但是,它没有工作:
$file_data['sys_filemounts']['NEW'] = array(
'base' => 2,
'description' => '',
'hidden' => 0,
'read_only' => 0,
'title' => strtolower($userName[0]."-".$userName[1]),
'path' => '/user_upload/MPL-People/'.strtolower($userName[0]."-".$userName[1].'/'),
'tx_gdemployeeimport_adid' => $adid
);
$this->createDir($userName);
$this->datahandler->start($file_data,array());
$this->datahandler->process_datamap();
$this->datahandler->clear_cacheCmd('all');
答案 0 :(得分:0)
$userName = explode(" ", $json['cn']);
$formatedName = strtolower($userName[0]."-".$userName[1]);
$extbaseObjectManager = GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Object\ObjectManager');
$newfileMountModel = $extbaseObjectManager->get('Graphodata\Gdemployeeimport\Domain\Model\GdFileMount');
$fileMountRepository = $extbaseObjectManager->get('Graphodata\Gdemployeeimport\Domain\Repository\GdFileMountRepository');
$newfileMountModel->setBase(2);
$newfileMountModel->setPid(0);
$newfileMountModel->setDescription('');
$newfileMountModel->setPath('/user_upload/MPL-People/'.$formatedName.'/');
$newfileMountModel->setReadOnly(0);
$newfileMountModel->setTitle($formatedName);
$newfileMountModel->setTitle($formatedName);
$newfileMountModel->setTxGdemployeeimportAdid($adid);
$fileMountRepository->add($newfileMountModel);
unset($newfileMountModel);
这有效...无论如何,谢谢:)