2

我正在对最新的 Contao 4 进行新闻迁移。

Can anyone please explain how the image files are related to tl_news table ?
Currently for my migration I have imagepath and imagename for the respective image.

When I add an image to a news in contao through backend. The following fields get updated in database. 

addImage => 1,

singleSRC => f52a3871946211e782662e3e7a222c66

But when I search singleSRC in tl_files.uuid , it doesn't show any records.

请帮助我找到在迁移到 Contao 4 期间如何映射图像

4

1 回答 1

2

(以及例如)中的字段singleSRC是包含与该字段相关的 UUID的二进制字段。tl_newstl_contenttl_calendar_eventstl_files.uuid

我不知道您究竟是如何实现新闻迁移脚本的。但是在 Contao 框架中,您可以通过以下方式获取文件的路径singleSRC,例如:

// $objNews is a \Contao\NewsModel object
$objFile = \Contao\FilesModel::findByUuid($objNews->singleSRC);
$strPath = $objFile->path;

这就是您将其添加回其他地方的新新闻条目的方式:

// $strPath contains the relative path of the file on the other installation
$objFile = \Contao\Dbafs::addResource($strPath);
$objNews->singleSRC = $objFile->uuid;
于 2017-10-06T08:15:40.983 回答