Bug #88533

`persistence.classes.*.newRecordStoragePid` does not get `stdWrap` applied (other than `persistence.storagePid`)

Added by Leonie Philine Bitto 15 days ago. Updated 15 days ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Start date:
2019-06-09
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

See \TYPO3\CMS\Extbase\Persistence\Generic\Backend::determineStoragePageIdForNewRecord():

if (isset($frameworkConfiguration['persistence']['classes'][$className]) && !empty($frameworkConfiguration['persistence']['classes'][$className]['newRecordStoragePid'])) {
    return (int)$frameworkConfiguration['persistence']['classes'][$className]['newRecordStoragePid'];
}

This makes `persistance.classes.*.newRecordStoragePid` unusable with the good practice of storing PID values in the site config.yaml as single source of truth, like that:

plugin.xyz.persistence.classes.Vendor\Ext\Domain\Model\FrontendUser {
    newRecordStoragePid.dataWrap = {site:pages.frontendUsers}
}

This approach does work with `persistence.storagePid`, because in `\TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager::getConfiguration()`, `stdWrap` is applied:

if (is_array($frameworkConfiguration['persistence']['storagePid'])) {
    // We simulate the frontend to enable the use of cObjects in
    // stdWrap. Than we convert the configuration to normal TypoScript
    // and apply the stdWrap to the storagePid
    if (!$this->environmentService->isEnvironmentInFrontendMode()) {
        \TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility::simulateFrontendEnvironment($this->getContentObject());
    }
    $conf = $this->typoScriptService->convertPlainArrayToTypoScriptArray($frameworkConfiguration['persistence']);
    $frameworkConfiguration['persistence']['storagePid'] = $GLOBALS['TSFE']->cObj->stdWrap($conf['storagePid'], $conf['storagePid.']);
    if (!$this->environmentService->isEnvironmentInFrontendMode()) {
        \TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility::resetFrontendEnvironment();
    }
}

History

#1 Updated by Leonie Philine Bitto 15 days ago

  • Subject changed from `persistance.classes.*.newRecordStoragePid` does not get `stdWrap` applied (other than `peristence.storagePid`) to `persistence.classes.*.newRecordStoragePid` does not get `stdWrap` applied (other than `peristence.storagePid`)

#2 Updated by Leonie Philine Bitto 15 days ago

  • Subject changed from `persistence.classes.*.newRecordStoragePid` does not get `stdWrap` applied (other than `peristence.storagePid`) to `persistence.classes.*.newRecordStoragePid` does not get `stdWrap` applied (other than `persistence.storagePid`)

Also available in: Atom PDF