plugin/exo/Controller/Api/AttemptController.php
public function useHintAction(Paper $paper, $questionId, $hintId, User $user = null, Request $request)
    {
        $this->assertHasPermission('OPEN', $paper->getExercise());
        $this->assertHasPaperAccess($paper, $user);

        try {
            $hint = $this->attemptManager->useHint($paper, $questionId, $hintId, $request->getClientIp());
        } catch (\Exception $e) {
            return new JsonResponse([[
                'path' => '',
                'message' => $e->getMessage(),
            ]], 422);
        }

        return new JsonResponse($hint);
    }
public function useHintAction(Paper $paper, $questionId, $hintId, User $user = null, Request $request)
    {
        $this->assertHasPermission('OPEN', $paper->getExercise());
        $this->assertHasPaperAccess($paper, $user);

        try {
            $hint = $this->attemptManager->useHint($paper, $questionId, $hintId, $request->getClientIp());
        } catch (\Exception $e) {
            return new JsonResponse([[
                'path' => '',
                'message' => $e->getMessage(),
            ]], 422);
        }

        return new JsonResponse($hint);
    }
public function useHintAction ( Paper $ paper , $ questionId , $ hintId , User $ user = null , Request $ request ) { $ this -> assertHasPermission ( 'OPEN' , $ paper -> getExercise ( ) ) ; $ this -> assertHasPaperAccess ( $ paper , $ user ) ; try { $ hint = $ this -> attemptManager -> useHint ( $ paper , $ questionId , $ hintId , $ request -> getClientIp ( ) ) ; } catch ( \ Exception $ e ) { return new JsonResponse ( [ [ 'path' => '' , 'message' => $ e -> getMessage ( ) , ] ] , 422 ) ; } return new JsonResponse ( $ hint ) ; }
Returns the content of a question hint, and records the fact that it has
been consulted within the context of a given paper.

@EXT\Route("/{id}/{questionId}/hints/{hintId}", name="exercise_attempt_hint_show")
@EXT\Method("GET")
@EXT\ParamConverter("user", converter="current_user", options={"allowAnonymous"=true})
@EXT\ParamConverter("paper", class="UJMExoBundle:Attempt\Paper", options={"mapping": {"id": "uuid"}})

@param Paper   $paper
@param string  $questionId
@param string  $hintId
@param User    $user
@param Request $request

@return JsonResponse
Returns the content of a question hint and records the fact that it has been consulted within the context of a given paper .