plugin/drop-zone/Manager/DropzoneManager.php
public function saveCorrection(array $data, User $user)
    {
        $this->om->startFlushSuite();
        $existingCorrection = $this->correctionRepo->findOneBy(['uuid' => $data['id']]);
        $isNew = empty($existingCorrection);
        $correction = $this->serializer->get(Correction::class)->deserialize($data);
        $correction->setUser($user);
        $dropzone = $correction->getDrop()->getDropzone();

        if (!$isNew) {
            $correction->setLastEditionDate(new \DateTime());
        }
        $correction = $this->computeCorrectionScore($correction);
        $this->om->persist($correction);
        $this->om->endFlushSuite();

        if ($isNew) {
            $this->eventDispatcher->dispatch('log', new LogCorrectionStartEvent($dropzone, $correction->getDrop(), $correction));
        } else {
            $this->eventDispatcher->dispatch('log', new LogCorrectionUpdateEvent($dropzone, $correction->getDrop(), $correction));
        }

        return $correction;
    }
public function saveCorrection(array $data, User $user)
    {
        $this->om->startFlushSuite();
        $existingCorrection = $this->correctionRepo->findOneBy(['uuid' => $data['id']]);
        $isNew = empty($existingCorrection);
        $correction = $this->serializer->get(Correction::class)->deserialize($data);
        $correction->setUser($user);
        $dropzone = $correction->getDrop()->getDropzone();

        if (!$isNew) {
            $correction->setLastEditionDate(new \DateTime());
        }
        $correction = $this->computeCorrectionScore($correction);
        $this->om->persist($correction);
        $this->om->endFlushSuite();

        if ($isNew) {
            $this->eventDispatcher->dispatch('log', new LogCorrectionStartEvent($dropzone, $correction->getDrop(), $correction));
        } else {
            $this->eventDispatcher->dispatch('log', new LogCorrectionUpdateEvent($dropzone, $correction->getDrop(), $correction));
        }

        return $correction;
    }
public function saveCorrection ( array $ data , User $ user ) { $ this -> om -> startFlushSuite ( ) ; $ existingCorrection = $ this -> correctionRepo -> findOneBy ( [ 'uuid' => $ data [ 'id' ] ] ) ; $ isNew = empty ( $ existingCorrection ) ; $ correction = $ this -> serializer -> get ( Correction :: class ) -> deserialize ( $ data ) ; $ correction -> setUser ( $ user ) ; $ dropzone = $ correction -> getDrop ( ) -> getDropzone ( ) ; if ( ! $ isNew ) { $ correction -> setLastEditionDate ( new \ DateTime ( ) ) ; } $ correction = $ this -> computeCorrectionScore ( $ correction ) ; $ this -> om -> persist ( $ correction ) ; $ this -> om -> endFlushSuite ( ) ; if ( $ isNew ) { $ this -> eventDispatcher -> dispatch ( 'log' , new LogCorrectionStartEvent ( $ dropzone , $ correction -> getDrop ( ) , $ correction ) ) ; } else { $ this -> eventDispatcher -> dispatch ( 'log' , new LogCorrectionUpdateEvent ( $ dropzone , $ correction -> getDrop ( ) , $ correction ) ) ; } return $ correction ; }
Updates a Correction.

@param array $data
@param User  $user

@return Correction
Updates a Correction .