plugin/drop-zone/Manager/DropzoneManager.php
public function submitCorrection(Correction $correction, User $user)
    {
        $this->om->startFlushSuite();

        $correction->setFinished(true);
        $correction->setEndDate(new \DateTime());
        $correction->setUser($user);
        $this->om->persist($correction);
        $this->om->forceFlush();
        $drop = $this->computeDropScore($correction->getDrop());
        $dropzone = $drop->getDropzone();
        $userDrop = null;
        $users = [];

        switch ($dropzone->getDropType()) {
            case Dropzone::DROP_TYPE_USER:
                $users = [$user];
                $userDrop = $this->getUserDrop($dropzone, $user);
                break;
            case Dropzone::DROP_TYPE_TEAM:
                $teamDrops = $this->getTeamDrops($dropzone, $user);

                if (1 === count($teamDrops)) {
                    $users = $teamDrops[0]->getUsers();
                    $userDrop = $teamDrops[0];
                }
                break;
        }
        $this->eventDispatcher->dispatch('log', new LogCorrectionEndEvent($dropzone, $correction->getDrop(), $correction));
        $this->om->forceFlush();

        $this->checkSuccess($drop);
        $this->checkCompletion($dropzone, $users, $userDrop);

        $this->om->endFlushSuite();

        return $correction;
    }
public function submitCorrection(Correction $correction, User $user)
    {
        $this->om->startFlushSuite();

        $correction->setFinished(true);
        $correction->setEndDate(new \DateTime());
        $correction->setUser($user);
        $this->om->persist($correction);
        $this->om->forceFlush();
        $drop = $this->computeDropScore($correction->getDrop());
        $dropzone = $drop->getDropzone();
        $userDrop = null;
        $users = [];

        switch ($dropzone->getDropType()) {
            case Dropzone::DROP_TYPE_USER:
                $users = [$user];
                $userDrop = $this->getUserDrop($dropzone, $user);
                break;
            case Dropzone::DROP_TYPE_TEAM:
                $teamDrops = $this->getTeamDrops($dropzone, $user);

                if (1 === count($teamDrops)) {
                    $users = $teamDrops[0]->getUsers();
                    $userDrop = $teamDrops[0];
                }
                break;
        }
        $this->eventDispatcher->dispatch('log', new LogCorrectionEndEvent($dropzone, $correction->getDrop(), $correction));
        $this->om->forceFlush();

        $this->checkSuccess($drop);
        $this->checkCompletion($dropzone, $users, $userDrop);

        $this->om->endFlushSuite();

        return $correction;
    }
public function submitCorrection ( Correction $ correction , User $ user ) { $ this -> om -> startFlushSuite ( ) ; $ correction -> setFinished ( true ) ; $ correction -> setEndDate ( new \ DateTime ( ) ) ; $ correction -> setUser ( $ user ) ; $ this -> om -> persist ( $ correction ) ; $ this -> om -> forceFlush ( ) ; $ drop = $ this -> computeDropScore ( $ correction -> getDrop ( ) ) ; $ dropzone = $ drop -> getDropzone ( ) ; $ userDrop = null ; $ users = [ ] ; switch ( $ dropzone -> getDropType ( ) ) { case Dropzone :: DROP_TYPE_USER : $ users = [ $ user ] ; $ userDrop = $ this -> getUserDrop ( $ dropzone , $ user ) ; break ; case Dropzone :: DROP_TYPE_TEAM : $ teamDrops = $ this -> getTeamDrops ( $ dropzone , $ user ) ; if ( 1 === count ( $ teamDrops ) ) { $ users = $ teamDrops [ 0 ] -> getUsers ( ) ; $ userDrop = $ teamDrops [ 0 ] ; } break ; } $ this -> eventDispatcher -> dispatch ( 'log' , new LogCorrectionEndEvent ( $ dropzone , $ correction -> getDrop ( ) , $ correction ) ) ; $ this -> om -> forceFlush ( ) ; $ this -> checkSuccess ( $ drop ) ; $ this -> checkCompletion ( $ dropzone , $ users , $ userDrop ) ; $ this -> om -> endFlushSuite ( ) ; return $ correction ; }
Submits a Correction.

@param Correction $correction
@param User       $user

@return Correction
Submits a Correction .