public function autocompleteRowArticleAction() { if ($this->request->isGet() && $this->request->isXmlHttpRequest()) { $auth = $this->getServiceLocator()->get('zfcuser_auth_service'); $user = $auth->getIdentity(); $articleArray = array(); $articles = $this->articleService->getArticlesByCodeOrName($user, $this->request->getQuery()->query); foreach ($articles as $article) { $value = $article->getCode() . '_' . str_replace(' ', '_', $article->getName()); $articleArray[] = array('value' => htmlspecialchars($value), 'id' => $article->getId()); } $json = new JsonModel($articleArray); return $json; } }