src/Synapse/User/UserController.php
public function put(Request $request)
    {
        $user = $this->getUser();

        $userValidationCopy = clone $user;

        // Validate the modified fields
        $content = $this->getContentAsArray($request);

        $errors = $this->userValidator->validate($content, $user);

        if (count($errors) > 0) {
            return $this->createConstraintViolationResponse($errors);
        }

        $userValidationCopy->exchangeArray($content ?: [])->getArrayCopy();

        try {
            $user = $this->userService->update($user, $this->getContentAsArray($request));
        } catch (OutOfBoundsException $e) {
            return $this->createEmailNotUniqueResponse();
        }

        return $this->userArrayWithoutPassword($user);
    }
public function put(Request $request)
    {
        $user = $this->getUser();

        $userValidationCopy = clone $user;

        // Validate the modified fields
        $content = $this->getContentAsArray($request);

        $errors = $this->userValidator->validate($content, $user);

        if (count($errors) > 0) {
            return $this->createConstraintViolationResponse($errors);
        }

        $userValidationCopy->exchangeArray($content ?: [])->getArrayCopy();

        try {
            $user = $this->userService->update($user, $this->getContentAsArray($request));
        } catch (OutOfBoundsException $e) {
            return $this->createEmailNotUniqueResponse();
        }

        return $this->userArrayWithoutPassword($user);
    }
public function put ( Request $ request ) { $ user = $ this -> getUser ( ) ; $ userValidationCopy = clone $ user ; // Validate the modified fields $ content = $ this -> getContentAsArray ( $ request ) ; $ errors = $ this -> userValidator -> validate ( $ content , $ user ) ; if ( count ( $ errors ) > 0 ) { return $ this -> createConstraintViolationResponse ( $ errors ) ; } $ userValidationCopy -> exchangeArray ( $ content ? : [ ] ) -> getArrayCopy ( ) ; try { $ user = $ this -> userService -> update ( $ user , $ this -> getContentAsArray ( $ request ) ) ; } catch ( OutOfBoundsException $ e ) { return $ this -> createEmailNotUniqueResponse ( ) ; } return $ this -> userArrayWithoutPassword ( $ user ) ; }
Edit a user; requires the user to be logged in and the current password provided

@param  Request $request
@return array
Edit a user ; requires the user to be logged in and the current password provided