我只是想用一个新的文本字段“版权”来扩展 sys_file_reference 表,这只是普通的 extbase 方式。像魅力一样工作,现场出现。但是当我使用 sys_file_reference 关系保存记录时,它不会添加引用。保存后它只是空的......无论记录是具有常规媒体字段的页面还是我的自定义扩展之一都没有关系。有人知道我错过了什么吗?
非常感谢您的帮助!
三氯乙酸:
$fileReferenceColumns = [
'copyright' => [
'exclude' => true,
'label' => $ll . 'sys_file_reference.copyright',
'config' => [
'type' => 'input',
'size' => 20,
'max' => 255,
'eval' => 'null',
'default' => null,
]
]];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('sys_file_reference', $fileReferenceColumns);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette(
'sys_file_reference',
'imageoverlayPalette',
'copyright'
);
SQL:
CREATE TABLE sys_file_reference (
copyright VARCHAR(255) DEFAULT '' NOT NULL,
);
模型:
class FileReference extends AbstractEntity
{
/**
* uid of a sys_file
*
* @var integer
*/
protected $originalFileIdentifier;
/**
* @var \TYPO3\CMS\Extbase\Domain\Model\File
*/
protected $file;
/**
* @var string
*/
protected $copyright;
/**
* setOriginalResource
*
* @param \TYPO3\CMS\Core\Resource\FileReference $originalResource
* @return void
*/
public function setOriginalResource(\TYPO3\CMS\Core\Resource\FileReference $originalResource)
{
$this->originalResource = $originalResource;
$this->originalFileIdentifier = (int)$originalResource->getOriginalFile()->getUid();
}
/**
* @return \TYPO3\CMS\Extbase\Domain\Model\File
*/
public function getFile()
{
return $this->file;
}
/**
* @param \TYPO3\CMS\Extbase\Domain\Model\File $file
*/
public function setFile($file)
{
$this->file = $file;
$this->originalFileIdentifier = $file->getUid();
}
/**
* @return string
*/
public function getCopyright()
{
return $this->copyright;
}
/**
* @param string $copyright
*/
public function setCopyright($copyright)
{
$this->copyright = $copyright;
}
}
排版:
config.tx_extbase {
persistence {
classes {
Interlutions\ItlGallery\Domain\Model\FileReference {
mapping {
tableName = sys_file_reference
columns {
uid_local.mapOnProperty = originalFileIdentifier
uid_local.mapOnProperty = file
votes.mapOnProperty = votes
}
}
}
}
objects {
TYPO3\CMS\Extbase\Domain\Model\FileReference.className = Interlutions\ItlGallery\Domain\Model\FileReference
}
}
}