plugin/exo/Manager/Attempt/PaperManager.php
public function serializeExercisePapers(Exercise $exercise, User $user = null)
    {
        if (!empty($user)) {
            // Load papers for of a single user
            $papers = $this->repository->findBy([
                'exercise' => $exercise,
                'user' => $user,
            ]);
        } else {
            // Load all papers submitted for the exercise
            $papers = $this->repository->findBy([
                'exercise' => $exercise,
            ]);
        }

        return array_map(function (Paper $paper) {
            return $this->serialize($paper);
        }, $papers);
    }
public function serializeExercisePapers(Exercise $exercise, User $user = null)
    {
        if (!empty($user)) {
            // Load papers for of a single user
            $papers = $this->repository->findBy([
                'exercise' => $exercise,
                'user' => $user,
            ]);
        } else {
            // Load all papers submitted for the exercise
            $papers = $this->repository->findBy([
                'exercise' => $exercise,
            ]);
        }

        return array_map(function (Paper $paper) {
            return $this->serialize($paper);
        }, $papers);
    }
public function serializeExercisePapers ( Exercise $ exercise , User $ user = null ) { if ( ! empty ( $ user ) ) { // Load papers for of a single user $ papers = $ this -> repository -> findBy ( [ 'exercise' => $ exercise , 'user' => $ user , ] ) ; } else { // Load all papers submitted for the exercise $ papers = $ this -> repository -> findBy ( [ 'exercise' => $ exercise , ] ) ; } return array_map ( function ( Paper $ paper ) { return $ this -> serialize ( $ paper ) ; } , $ papers ) ; }
Returns the papers for a given exercise, in a JSON format.

@param Exercise $exercise
@param User     $user

@return array
Returns the papers for a given exercise in a JSON format .