I have a NewsRepository and a News model. The storagePid is 74. I have a script which checks if the endtime field of the new record is overdue. If it is, I want to move the record in another folder (UID 170).

When I do:

$news = $newsRepository->findByUid( 1 );
$news->setTitle( 'News ' . rand(1,99999) );
$news->setPid( 170 );
$newsRepository->update( $news );

The title is changed, but the PID is not.

So, how can I move the new onto another page?

有帮助吗?

解决方案

You need to add the pid to the TCA.

This is the correct way, so it wont be displayed in the backend.

'pid' => array(
    'config' => array(
        'type' => 'passthrough',
    )
),

其他提示

Looks like the pid filed should be set in TCA also. I added

'pid' => Array(
    'exclude' => 1,
    'label' => 'PID',
    'config' => array(
        'type' => 'none',
    )
),

in the columns section of the TCA and now the PID is saved.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top