plugin/exo/Manager/Attempt/AnswerManager.php
public function update(Item $question, Answer $answer, array $answerData, $noFlush = false)
    {
        $errors = $this->validator->validate($answerData, [Validation::QUESTION => $question->getInteraction()]);
        if (count($errors) > 0) {
            throw new InvalidDataException('Answer is not valid', $errors);
        }

        // Update Answer with new data
        $this->serializer->deserialize($answerData, $answer);

        // Save to DB
        $this->om->persist($answer);

        if (!$noFlush) {
            $this->om->flush();
        }

        return $answer;
    }
public function update(Item $question, Answer $answer, array $answerData, $noFlush = false)
    {
        $errors = $this->validator->validate($answerData, [Validation::QUESTION => $question->getInteraction()]);
        if (count($errors) > 0) {
            throw new InvalidDataException('Answer is not valid', $errors);
        }

        // Update Answer with new data
        $this->serializer->deserialize($answerData, $answer);

        // Save to DB
        $this->om->persist($answer);

        if (!$noFlush) {
            $this->om->flush();
        }

        return $answer;
    }
public function update ( Item $ question , Answer $ answer , array $ answerData , $ noFlush = false ) { $ errors = $ this -> validator -> validate ( $ answerData , [ Validation :: QUESTION => $ question -> getInteraction ( ) ] ) ; if ( count ( $ errors ) > 0 ) { throw new InvalidDataException ( 'Answer is not valid' , $ errors ) ; } // Update Answer with new data $ this -> serializer -> deserialize ( $ answerData , $ answer ) ; // Save to DB $ this -> om -> persist ( $ answer ) ; if ( ! $ noFlush ) { $ this -> om -> flush ( ) ; } return $ answer ; }
Validates and updates an Answer entity with raw data.

@param Item   $question
@param Answer $answer
@param array  $answerData
@param bool   $noFlush

@return Answer

@throws InvalidDataException
Validates and updates an Answer entity with raw data .