我有一个NewsRepository和一个News模型。storagePid为74。我有一个脚本,用于检查新记录的结束时间字段是否过期。如果是,我想将记录移到另一个文件夹(UID 170)。
当我这样做:
$news = $newsRepository->findByUid( 1 );
$news->setTitle( 'News ' . rand(1,99999) );
$news->setPid( 170 );
$newsRepository->update( $news );
标题已更改,但PID未更改。
所以,如何将新内容移动到另一页上?
您需要将pid添加到TCA。
这是正确的方法,因此它不会在后端显示。
'pid' => array(
'config' => array(
'type' => 'passthrough',
)
),
看起来像pid字段也应在TCA中设置。我加了
'pid' => Array(
'exclude' => 1,
'label' => 'PID',
'config' => array(
'type' => 'none',
)
),
在TCA的columns部分中,现在已保存PID。