public function save()
{
$this->initScope();
$sectionId = $this->getSection();
$groups = $this->getGroups();
if (empty($groups)) {
return $this;
}
$oldConfig = $this->_getConfig(true);
$deleteTransaction = $this->_transactionFactory->create();
$saveTransaction = $this->_transactionFactory->create();
$extraOldGroups = [];
foreach ($groups as $groupId => $groupData) {
$this->_processGroup($groupId, $groupData, $groups, $sectionId, $extraOldGroups, $oldConfig, $saveTransaction, $deleteTransaction);
}
try {
$deleteTransaction->delete();
$saveTransaction->save();
$this->_appConfig->reinit();
$this->_eventManager->dispatch("smile_elasticsuite_relevance_config_changed_section_{$this->getSection()}", ['container' => $this->getContainer(), 'store' => $this->getStore()]);
} catch (\Exception $e) {
$this->_appConfig->reinit();
throw $e;
}
return $this;
}