'TYPO3 change PID in TCA

I am trying to change the pid in my extension. I added the pid field to my tca, it also shows the current pid, but as soon as I change it and save it, the old pid comes back :(

        'pid' => [
        'exclude' => true,
        'label' => 'change pid',
        'config' => [
            'type' => 'input',
            'size' => 30,
            'eval' => 'trim'
        ],
    ],

what am I doing wrong?



Solution 1:[1]

You can use this to set pid like this.

$querySettings = $this->yourRepository->createQuery()->getQuerySettings();
$querySettings->setStoragePageIds([$pid]);
$this->yourRepository->setDefaultQuerySettings($querySettings);

I am not sure about the requirement, If I am wrong here, please excuse me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Siva