Controller/ProfileController.php
public function updateAction(Request $request)
    {
        $user = $this->getUser();
        $form = $this->createForm(ProfileType::class, $user);

        $form->bind($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();

            try {
                $em->persist($user);
                $em->flush();

                $this->get('session')->getFlashBag()->set('success', 'Your changes have been saved.');

                return new JsonReloadResponse();
            } catch (\Exception $e) {
                $form->addError(new FormError('Could not save changes. If the problem persists, please contact support.'));
            }
        }

        return new JsonErrorResponse($form);
    }
public function updateAction(Request $request)
    {
        $user = $this->getUser();
        $form = $this->createForm(ProfileType::class, $user);

        $form->bind($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();

            try {
                $em->persist($user);
                $em->flush();

                $this->get('session')->getFlashBag()->set('success', 'Your changes have been saved.');

                return new JsonReloadResponse();
            } catch (\Exception $e) {
                $form->addError(new FormError('Could not save changes. If the problem persists, please contact support.'));
            }
        }

        return new JsonErrorResponse($form);
    }
Updates the current user's profile

@Route("/update", name="orkestra_profile_update", defaults={"_format"="json"})
@Secure(roles="ROLE_USER")
@Method("POST")