Вопрос

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