#68548[1.2.2]: Attempt to modify record '[No title]' (sys_file_reference:5297) without permission. Or non-existing page.
Description
I get this error while trying to add file reference.
/**
*
* @param integer $pagesUid pages.uid
* @param integer $contentElementUid tt_content.uid
* @param array $fileObjects fal file original and fal file reference array
*/
function addFalFileReference($pagesUid, $contentElementUid, $fileObjects) {
t3lib_div::devLog('function addFalFileReference', 'pritlisp', 2, array('refernce uid' => $fileObjects[0]['reference']['uid']));
$data = array();
$data['sys_file_reference'][$fileObjects[0]['reference']['uid']] = array(
'uid_local' => $fileObjects[0]['reference']['uid_local'],
'uid_foreign' => $contentElementUid, // uid of your content record
'tablenames' => 'tt_content',
'fieldname' => 'image',
'pid' => $pagesUid, // parent id of the parent page
'table_local' => 'sys_file',
);
$data['tt_content'][$contentElementUid] = array('image' => '1');
t3lib_div::devLog('function addFalFileReference', 'pritlisp', 2, array('data' => $data));
$this->falData2Publish = $data;
}
/**
*
*
*/
function publishFalData() {
/** @var \TYPO3\CMS\Core\DataHandling\DataHandler $tce */
$tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Core\DataHandling\DataHandler'); // create TCE instance
$tce->start($this->falData2Publish, array());
$tce->process_datamap();
if ($tce->errorLog) {
t3lib_div::devLog('function publishFalData', 'pritlisp', 3, array('tce->errorLog' => $tce->errorLog));
} else {
t3lib_div::devLog('function publishFalData', 'pritlisp', 3, array('data' => $data));
}
}
This issue has been reported before:
https://forge.typo3.org/issues/50758
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.