Till today all the code was okay, but after code review, I got that we use the method

load() on the store itself so I replaced it with


Code what I'm talking about first fetched by load() then created the new entity by factory if it wasn't found. Right now after replacement, a problem occurred - method get() in storeRepository injects itself StoreFactory to create new store if it's not found, the problem is it fetches it from config,

but is it standard core_config_data Config ? If so, what parameters I should write to that config and what arguments in method save() of configuration should be used?

  • Can you update your full code? Sep 25, 2018 at 8:45
  • @SukumarGorai Actually I'm testing some other approach if so I will provide text explanation. Can't post code since my Company Privacy Policy forbidden me to do so. Sep 25, 2018 at 8:47
  • So as I came to apporach where it's usable the best way is to replace $model->load() with $resourceModel->load() and if it's not returning id create it with factory and save with $resourceModel->save($factory) or just get $storeRepository->get($code) with Try catch block and validate exception the method returns to create new entity with factory and save as above. Sep 25, 2018 at 9:16
  • Should I provide it as answer and mark it as solved? Couldn't update. Sep 25, 2018 at 9:21


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy