public function addAction() { //$escaper = new Escaper('utf-8'); $jsonModel = new JsonModel(); $note = new Note(); //$escaper->escapeHtmlAttr(); $title = $this->params()->fromPost('title'); $content = $this->params()->fromPost('content'); if (!empty($title) && !empty($content)) { $authenticationService = new AuthenticationService(); $user = $authenticationService->getStorage()->read(); $note->setUser($user->id); $note->setTitle($title); $note->setContent($content); $result = $this->getNoteTable()->save($note); $jsonModel->setVariable("result", $result); } else { $result = false; } $jsonModel->setVariable("result", $result); return $jsonModel; }