2

I am developing one extension in which I have one configuration form, after filling form when I click save button it successfully save the data in core_config_data, but to retrieve that data from table I need to flush M2 cache. How can I get data from DB without flushing cache.

I am using below code to get data from DB:

$data   =  $this->_scopeConfig->getValue('user', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);

1 Answer 1

1

You can try the below code :

So Inject a Magento\Config\Model\ResourceModel\Config\Data\CollectionFactory in your class.

Then try:

$collection = $collectionFactory->create();
$collection->addScopeFilter($scope, $scopeId, $section)

The $section is the path, $scopeId the id of the store or website depending on the scope & $scope is either "stores" or "website" or "default".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.