public function checkExistanceAction() { $groupType = new GroupType(); $newGroupParam = $this->getParameter($groupType->getName())['name']; $newGroup = $this->get('fos_user.group_manager')->findGroupByName($newGroupParam); $name = $this->getParameter('name'); $group = $this->get('fos_user.group_manager')->findGroupByName($name); $edit = $this->getParameter('edit'); if ($newGroup instanceof Grupo && Util::Canonicalize($name) != Util::Canonicalize($newGroupParam) && $edit == true) { return new JsonResponse("El grupo <b>{$newGroupParam}</b> ya se encuentra en uso."); } if ($group instanceof Grupo && $newGroup instanceof Grupo && $edit != true) { return new JsonResponse("El grupo <b>{$name}</b> ya se encuentra en uso."); } return new JsonResponse(true); }
public function checkMailExistanceAction() { $name = $this->getParameter('email'); $user = $this->get('fos_user.user_manager')->findUserByEmail($name); $edit = $this->getParameter('edit'); $userType = new UsuarioType(); if ($edit == true) { $userType = new UsuarioEditType(); } $newUserParam = $this->getParameter($userType->getName())['email']; $newUser = $this->get('fos_user.user_manager')->findUserByEmail($newUserParam); if ($newUser instanceof Usuario && Util::Canonicalize($name) != Util::Canonicalize($newUserParam) && $edit == true) { return new JsonResponse("El correo <b>{$newUserParam}</b> ya se encuentra en uso."); } if ($user instanceof Usuario && $newUser instanceof Usuario && $edit != true) { return new JsonResponse("El correo <b>{$name}</b> ya se encuentra en uso."); } return new JsonResponse(true); }