serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class); parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data); } /** * @return void */ protected function _afterLoad() { $value = $this->getValue(); if (!is_array($value)) { $this->setValue(empty($value) ? false : $this->serializer->unserialize($value)); } } /** * @return $this */ public function beforeSave() { if (is_array($this->getValue())) { $this->setValue($this->serializer->serialize($this->getValue())); } parent::beforeSave(); return $this; } }