简体   繁体   English

TYPO3 Extbase storagePid

[英]TYPO3 Extbase storagePid

I need to get the actual "general record storage page id". 我需要获得实际的“常规记录存储页面ID”。 I found the following snipplet but the variable is empty even though the storagePid is set on the page. 我发现了下面的snipplet,但即使在页面上设置了storagePid,变量也是空的。

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

Any help would be appreciated 任何帮助,将不胜感激

I'm not quite sure, what are you trying to get. 我不太确定,你想要得到什么。 Snippet you provided gets without problems the storagePid set in constants for your extension, the same as this code from setup.txt : 您提供的代码段可以毫无问题地为您的扩展程序设置常量中的storagePid,与setup.txt此代码相同:

plugin.tx_yourext {
    persistence {
        storagePid = {$plugin.tx_yourext.persistence.storagePid}
    }
}

if you have problems with getting your storagePid with provided snippet also can modify your setup.txt and make sure that the value will be also propagated into settings scope: 如果您在使用提供的代码段获取storagePid时遇到问题,也可以修改setup.txt并确保该值也会传播到settings范围:

plugin.tx_yourext {
    persistence {
        storagePid = {$plugin.tx_yourext.persistence.storagePid}
    }
    settings {
        storagePid = {$plugin.tx_yourext.persistence.storagePid}
    }
}

then in your controller you can catch it with simpler code: 然后在你的控制器中你可以用更简单的代码捕获它:

$myStoragePid = $this->settings['storagePid'];

if it will not work for you that means, you didn't set proper value in Constants for YourExt and/or didn't cleared the caches in the BE. 如果它不适合你,那意味着你没有在Constants for YourExt中设置适当的值和/或没有清除BE中的缓存。

BTW: Maybe if you'll be more specific I could send better answer. 顺便说一句:也许如果你更具体,我可以发出更好的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM