public function onBeforeStore(Event $event) { if ($this->params && !is_string($this->params)) { $this->params = json_encode($this->params); } }