plugin/drop-zone/Manager/DropzoneManager.php
public function getTeamDrop(Dropzone $dropzone, Team $team, User $user, $withCreation = false)
    {
        $drop = $this->dropRepo->findOneBy(['dropzone' => $dropzone, 'teamUuid' => $team->getUuid()]);

        if ($withCreation) {
            if (empty($drop)) {
                $this->om->startFlushSuite();
                $drop = new Drop();
                $drop->setUser($user);
                $drop->setDropzone($dropzone);
                $drop->setTeamId($team->getId());
                $drop->setTeamUuid($team->getUuid());
                $drop->setTeamName($team->getName());

                foreach ($team->getRole()->getUsers() as $teamUser) {
                    $drop->addUser($teamUser);
                    /* TODO: checks that a valid status is not overwritten */
                    $this->resourceEvalManager->createResourceEvaluation(
                        $dropzone->getResourceNode(),
                        $teamUser,
                        null,
                        ['status' => AbstractResourceEvaluation::STATUS_INCOMPLETE]
                    );
                }
                $this->om->persist($drop);
                $this->om->endFlushSuite();

                $this->eventDispatcher->dispatch('log', new LogDropStartEvent($dropzone, $drop));
            } elseif (!$drop->hasUser($user)) {
                $this->om->startFlushSuite();
                $drop->addUser($user);
                $this->resourceEvalManager->createResourceEvaluation(
                    $dropzone->getResourceNode(),
                    $user,
                    null,
                    ['status' => AbstractResourceEvaluation::STATUS_INCOMPLETE]
                );
                $this->om->persist($drop);
                $this->om->endFlushSuite();
            }
        }

        return $drop;
    }
public function getTeamDrop(Dropzone $dropzone, Team $team, User $user, $withCreation = false)
    {
        $drop = $this->dropRepo->findOneBy(['dropzone' => $dropzone, 'teamUuid' => $team->getUuid()]);

        if ($withCreation) {
            if (empty($drop)) {
                $this->om->startFlushSuite();
                $drop = new Drop();
                $drop->setUser($user);
                $drop->setDropzone($dropzone);
                $drop->setTeamId($team->getId());
                $drop->setTeamUuid($team->getUuid());
                $drop->setTeamName($team->getName());

                foreach ($team->getRole()->getUsers() as $teamUser) {
                    $drop->addUser($teamUser);
                    /* TODO: checks that a valid status is not overwritten */
                    $this->resourceEvalManager->createResourceEvaluation(
                        $dropzone->getResourceNode(),
                        $teamUser,
                        null,
                        ['status' => AbstractResourceEvaluation::STATUS_INCOMPLETE]
                    );
                }
                $this->om->persist($drop);
                $this->om->endFlushSuite();

                $this->eventDispatcher->dispatch('log', new LogDropStartEvent($dropzone, $drop));
            } elseif (!$drop->hasUser($user)) {
                $this->om->startFlushSuite();
                $drop->addUser($user);
                $this->resourceEvalManager->createResourceEvaluation(
                    $dropzone->getResourceNode(),
                    $user,
                    null,
                    ['status' => AbstractResourceEvaluation::STATUS_INCOMPLETE]
                );
                $this->om->persist($drop);
                $this->om->endFlushSuite();
            }
        }

        return $drop;
    }
public function getTeamDrop ( Dropzone $ dropzone , Team $ team , User $ user , $ withCreation = false ) { $ drop = $ this -> dropRepo -> findOneBy ( [ 'dropzone' => $ dropzone , 'teamUuid' => $ team -> getUuid ( ) ] ) ; if ( $ withCreation ) { if ( empty ( $ drop ) ) { $ this -> om -> startFlushSuite ( ) ; $ drop = new Drop ( ) ; $ drop -> setUser ( $ user ) ; $ drop -> setDropzone ( $ dropzone ) ; $ drop -> setTeamId ( $ team -> getId ( ) ) ; $ drop -> setTeamUuid ( $ team -> getUuid ( ) ) ; $ drop -> setTeamName ( $ team -> getName ( ) ) ; foreach ( $ team -> getRole ( ) -> getUsers ( ) as $ teamUser ) { $ drop -> addUser ( $ teamUser ) ; /* TODO: checks that a valid status is not overwritten */ $ this -> resourceEvalManager -> createResourceEvaluation ( $ dropzone -> getResourceNode ( ) , $ teamUser , null , [ 'status' => AbstractResourceEvaluation :: STATUS_INCOMPLETE ] ) ; } $ this -> om -> persist ( $ drop ) ; $ this -> om -> endFlushSuite ( ) ; $ this -> eventDispatcher -> dispatch ( 'log' , new LogDropStartEvent ( $ dropzone , $ drop ) ) ; } elseif ( ! $ drop -> hasUser ( $ user ) ) { $ this -> om -> startFlushSuite ( ) ; $ drop -> addUser ( $ user ) ; $ this -> resourceEvalManager -> createResourceEvaluation ( $ dropzone -> getResourceNode ( ) , $ user , null , [ 'status' => AbstractResourceEvaluation :: STATUS_INCOMPLETE ] ) ; $ this -> om -> persist ( $ drop ) ; $ this -> om -> endFlushSuite ( ) ; } } return $ drop ; }
Gets team drop or creates one.

@param Dropzone $dropzone
@param Team     $team
@param User     $user
@param bool     $withCreation

@return Drop
Gets team drop or creates one .