plugin/exo/Serializer/Attempt/AnswerSerializer.php
public function deserialize($data, Answer $answer = null, array $options = [])
    {
        $answer = $answer ?: new Answer();

        $this->sipe('id', 'setUuid', $data, $answer);
        $this->sipe('questionId', 'setQuestionId', $data, $answer);
        $this->sipe('tries', 'setTries', $data, $answer);
        $this->sipe('score', 'setScore', $data, $answer);
        $this->sipe('feedback', 'setFeedback', $data, $answer);

        if (isset($data['usedHints'])) {
            foreach ($data['usedHints'] as $usedHint) {
                $answer->addUsedHint($usedHint['id']);
            }
        }
        if (!empty($data['data'])) {
            $answer->setData(json_encode($data['data']));
        }

        return $answer;
    }
public function deserialize($data, Answer $answer = null, array $options = [])
    {
        $answer = $answer ?: new Answer();

        $this->sipe('id', 'setUuid', $data, $answer);
        $this->sipe('questionId', 'setQuestionId', $data, $answer);
        $this->sipe('tries', 'setTries', $data, $answer);
        $this->sipe('score', 'setScore', $data, $answer);
        $this->sipe('feedback', 'setFeedback', $data, $answer);

        if (isset($data['usedHints'])) {
            foreach ($data['usedHints'] as $usedHint) {
                $answer->addUsedHint($usedHint['id']);
            }
        }
        if (!empty($data['data'])) {
            $answer->setData(json_encode($data['data']));
        }

        return $answer;
    }
public function deserialize ( $ data , Answer $ answer = null , array $ options = [ ] ) { $ answer = $ answer ? : new Answer ( ) ; $ this -> sipe ( 'id' , 'setUuid' , $ data , $ answer ) ; $ this -> sipe ( 'questionId' , 'setQuestionId' , $ data , $ answer ) ; $ this -> sipe ( 'tries' , 'setTries' , $ data , $ answer ) ; $ this -> sipe ( 'score' , 'setScore' , $ data , $ answer ) ; $ this -> sipe ( 'feedback' , 'setFeedback' , $ data , $ answer ) ; if ( isset ( $ data [ 'usedHints' ] ) ) { foreach ( $ data [ 'usedHints' ] as $ usedHint ) { $ answer -> addUsedHint ( $ usedHint [ 'id' ] ) ; } } if ( ! empty ( $ data [ 'data' ] ) ) { $ answer -> setData ( json_encode ( $ data [ 'data' ] ) ) ; } return $ answer ; }
Converts raw data into a Answer entity.

@param array  $data
@param Answer $answer
@param array  $options

@return Answer
Converts raw data into a Answer entity .