public function existnameAction() { $name = $this->getRequest()->getParam('name'); if (empty($name)) { throw new InvalidArgumentException('No name given'); } $type = $this->getRequest()->getParam('type'); if (empty($type)) { throw new InvalidArgumentException('No type given'); } // Fetch user matching the username $exist = $this->_templateSrv->existName($name, $type); $this->view->data = $exist; }