* @copyright 2021 DIGITAL RETAIL TECHNOLOGIES SL * @license https://opensource.org/licenses/MIT The MIT License * * Don't forget to prefix your containers with your own identifier * to avoid any conflicts with others containers. */ class RetailcrmSettingsItemJson extends RetailcrmSettingsItem { public function getValue() { $value = parent::getValue(); if (is_string($value)) { return json_decode($value, true); } if (is_array($value)) { return $value; } return []; } public function getValueForUpdate() // todo change to protected { $value = parent::getValue(); if (is_array($value)) { return json_encode($value); } return $value; } public function getValueStored() { $valueStored = parent::getValueStored(); return (array) json_decode($valueStored, true); } }