public function onBeforeWrite() { parent::onBeforeWrite(); if ($this->Content && $this->UploadToken && $this->UploadToken == $this->SuppliedToken) { $this->SuppliedToken = ''; $this->UploadToken = ''; $data = json_decode($this->Content); if ($data && is_array($data->response)) { $this->syncrotronService->processUpdateData($data->response); } } if (strlen($this->UploadToken) === 0) { $this->UploadToken = mt_rand(100000, 999999); } }