public function create($data) { $this->getEntityManager(); $user = new \User\Entity\User($data); $user->validate($this->em); $this->getEntityManager()->persist($user); $this->getEntityManager()->flush(); return new JsonModel($user->toArray()); }