symfony - FOSUserBundle validate email in controller -


i'm trying validate fields fosuserbundle in controller. i'm passing values ​​from request without using form (i'm using jquery plugin x-editable). far have tried way saves me email if invalid or empty:

    $userid = $request->get('pk');     $value = $request->get('value');      $em = $this->getdoctrine()->getmanager();     $user = $em->getrepository('acmeuserbundle:user')->find($userid);     if (!$user) {         throw $this->createnotfoundexception('unable find products entity.');     }     $user->setemail($value);      $validator = $this->container->get('validator');     $errors = $validator->validate($user, array('profile'));      if (count($errors) > 0) {         return new response(print_r($errors, true), 400);     }      $this->container->get('fos_user.user_manager')->updateuser($user);             return new response('', 200); 

where doing wrong?

fosuserbundle uses "profile" validation group , not lowercase "profile".

have @ validation configuration here , here.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -