TYPO3 Extbase storagePid

net*_*ase 4 typo3 extbase

我需要获得实际的"常规记录存储页面ID".我发现了下面的snipplet,但即使在页面上设置了storagePid,变量也是空的.

$config = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
var_dump($config['persistence']['storagePid']);
Run Code Online (Sandbox Code Playgroud)

任何帮助,将不胜感激

bie*_*ior 10

我不太确定,你想要得到什么.您提供的代码段可以毫无问题地为您的扩展程序设置常量中的storagePid,与以下代码相同setup.txt:

plugin.tx_yourext {
    persistence {
        storagePid = {$plugin.tx_yourext.persistence.storagePid}
    }
}
Run Code Online (Sandbox Code Playgroud)

如果您在使用提供的代码段获取storagePid时遇到问题,也可以修改您的内容setup.txt并确保该值也会传播到settings范围中:

plugin.tx_yourext {
    persistence {
        storagePid = {$plugin.tx_yourext.persistence.storagePid}
    }
    settings {
        storagePid = {$plugin.tx_yourext.persistence.storagePid}
    }
}
Run Code Online (Sandbox Code Playgroud)

然后在你的控制器中你可以用更简单的代码捕获它:

$myStoragePid = $this->settings['storagePid'];
Run Code Online (Sandbox Code Playgroud)

如果它不适合你,那意味着你没有Constants为YourExt 设置正确的值和/或没有清除BE中的缓存.

顺便说一句:也许如果你更具体,我可以发出更好的答案.