src/Services/UserService.php
/**
     * Method for partial update of entity
     *
     * @param string $id ID of user entity
     * @param string $data JSON request data
     *
     * @return User
     * @throws EntityNotFoundException
     * @throws ValidationException
     */
Method for partial update of entity
@param string $id ID of user entity
@param string $data JSON request data


Method for partial update of entity @param string $id ID of user entity @param string $data JSON request data
public function updateUser(string $id, string $data)
    {
        $data = json_decode($data, true);
        $violations = $this->validator->validate(
            $data,
            UserRestConstraint::getPutMethodConstraint()
        );
        if ($violations->count() !== 0) {
            throw new ValidationException($violations);
        }
        $user = $this->repository->find($id);
        if ( $user === null ) {
            throw new EntityNotFoundException();
        }
        $this->serializer->denormalize(
            $data,
            User::class,
            'json',
            ['object_to_populate' => $user]
        );
        $this->entityManager->flush($user);
        return $user;
    }
public function updateUser ( string $ id , string $ data ) { $ data = json_decode ( $ data , true ) ; $ violations = $ this -> validator -> validate ( $ data , UserRestConstraint :: getPutMethodConstraint ( ) ) ; if ( $ violations -> count ( ) !== 0 ) { throw new ValidationException ( $ violations ) ; } $ user = $ this -> repository -> find ( $ id ) ; if ( $ user === null ) { throw new EntityNotFoundException ( ) ; } $ this -> serializer -> denormalize ( $ data , User :: class , 'json' , [ 'object_to_populate' => $ user ] ) ; $ this -> entityManager -> flush ( $ user ) ; return $ user ; }
Method for partial update of entity
 @param string $id ID of user entity
 @param string $data JSON request data
Method for partial update of entity @param string $id ID of user entity @param string $data JSON request data
/** @var User|null $user */