【问题标题】:FAL saving image in backend module does not set the uid_local后端模块中的 FAL 保存图像未设置 uid_local
【发布时间】:2014-04-29 09:33:59
【问题描述】:

我有一个后端模块,可以将一些数据从旧的“配置文件”数据库传输到 TYPO3。 对于图像,我首先将它们重命名并将它们放在存储中。 配置文件的记录也已被复制并存储在数据库中。

然后我获取配置文件存储中每个文件的文件信息

$file = $storage->getFile($filetoget['filename']);

给我我需要的东西。

然后我创建一个新的文件引用对象:

$profilemedia =  $this->objectManager->get('TYPO3\Regprofiler\Domain\Model\FileReference');

我可以向这个对象添加我需要的所有属性。 我也设置了:

$profilemedia->setUidLocal($fileProps['uid']);

当我将图像添加到我的配置文件并更新我的配置文件存储库时,所有文件引用都按预期存储,除了 uid_local,它保持为 0 有什么烦人的,因为这样我没有得到对 sys_file 的引用,因此:没有图像。

那么我为什么不存储 uid_local 呢?

我的图像 TCA

'image' => array(
            'exclude' => 1,
            'label' => 'image',
            'l10n_mode' => 'mergeIfNotBlank',
            'config' => array(
                'type' => 'inline',
                'foreign_sortby' => 'sorting',
                'foreign_table' => 'tx_regprofiler_domain_model_profiler',
                'foreign_field' => 'parent',
                'size' => 5,
                'minitems' => 0,
                'maxitems' => 99,
                'appearance' => array(
                    'collapseAll' => 1,
                    'expandSingle' => 1,
                    'levelLinksPosition' => 'bottom',
                    'useSortable' => 1,
                    'showPossibleLocalizationRecords' => 1,
                    'showRemovedLocalizationRecords' => 1,
                    'showAllLocalizationLink' => 1,
                    'showSynchronizationLink' => 1,
                    'enabledControls' => array(
                        'info' => FALSE,
                    )
                )
            )
        ),

【问题讨论】:

    标签: typo3 extbase


    【解决方案1】:

    请确保在创建模块以生成数据之前,您可以使用 TYPO3-Backend 创建数据库记录。只需添加一条记录并检查您是否可以在那里添加图像。如果出现,则说明您的模块中有错误,否则您的 TCA 中有错误。

    也推荐使用

    $TCA['tx_yourext_domain_model_yourmodel']['columns']['image']['config'] =
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('yourImageFieldHere',
        array(
            'maxitems' => 1,
            'appearance' => array(
                'createNewRelationLinkTitle' => 'LLL:EXT:nwb_page_tools/Resources/Private/Language/locallang_customlabels.xlf:add_image'
            )
        ),
        'jpg,png'
    );
    

    在您的 TCA 定义中。这是一个核心方法,可以查看here

    【讨论】:

    • Tnx Merdec,我确实 shnegd TCA,但这似乎没有解决它。
    猜你喜欢
    • 2011-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-30
    相关资源
    最近更新 更多