public function addAction() { if ($this->request->isPost()) { $user = new User(); $user->setFullName($this->getRequest()->getPost('fullname')); $this->getObjectManager()->persist($user); $this->getObjectManager()->flush(); $newId = $user->getId(); return $this->redirect()->toRoute('home'); } return new ViewModel(); }