monsieurbiz / SyliusSettingsPlugin

Provide some custom settings to your favorite Sylius shop!
MIT License
23 stars 18 forks source link

Update the current value in the code is complicated #46

Closed flochntrl closed 1 year ago

flochntrl commented 2 years ago

It could be great to have a method to update a setting in a service

jacquesbh commented 1 year ago

Hi @flochntrl,

You can still load the value using the repository and update its value.

$setting = $this->settingRepository->findOneBy([
    'vendor' => $vendor,
    'plugin' => $plugin,
    'path' => $path,
    'localeCode' => $localeCode,
    'channel' => $channelCode,
]);
$setting->setValue('foo');
$this->settingRepository->persist($setting);
$this->settingRepository->flush();