plugin/drop-zone/Manager/DropzoneManager.php
public function createDocument(Drop $drop, User $user, $documentType, $documentData)
    {
        $document = new Document();
        $document->setDrop($drop);
        $document->setUser($user);
        $document->setDropDate(new \DateTime());
        $document->setType($documentType);
        if (Document::DOCUMENT_TYPE_RESOURCE === $document->getType()) {
            $resourceNode = $this->resourceNodeRepo->findOneBy(['uuid' => $documentData]);
            $document->setData($resourceNode);
        } else {
            $document->setData($documentData);
        }

        $this->om->persist($document);
        $this->om->flush();

        $this->eventDispatcher->dispatch('log', new LogDocumentCreateEvent($drop->getDropzone(), $drop, $document));

        return $document;
    }
public function createDocument(Drop $drop, User $user, $documentType, $documentData)
    {
        $document = new Document();
        $document->setDrop($drop);
        $document->setUser($user);
        $document->setDropDate(new \DateTime());
        $document->setType($documentType);
        if (Document::DOCUMENT_TYPE_RESOURCE === $document->getType()) {
            $resourceNode = $this->resourceNodeRepo->findOneBy(['uuid' => $documentData]);
            $document->setData($resourceNode);
        } else {
            $document->setData($documentData);
        }

        $this->om->persist($document);
        $this->om->flush();

        $this->eventDispatcher->dispatch('log', new LogDocumentCreateEvent($drop->getDropzone(), $drop, $document));

        return $document;
    }
public function createDocument ( Drop $ drop , User $ user , $ documentType , $ documentData ) { $ document = new Document ( ) ; $ document -> setDrop ( $ drop ) ; $ document -> setUser ( $ user ) ; $ document -> setDropDate ( new \ DateTime ( ) ) ; $ document -> setType ( $ documentType ) ; if ( Document :: DOCUMENT_TYPE_RESOURCE === $ document -> getType ( ) ) { $ resourceNode = $ this -> resourceNodeRepo -> findOneBy ( [ 'uuid' => $ documentData ] ) ; $ document -> setData ( $ resourceNode ) ; } else { $ document -> setData ( $ documentData ) ; } $ this -> om -> persist ( $ document ) ; $ this -> om -> flush ( ) ; $ this -> eventDispatcher -> dispatch ( 'log' , new LogDocumentCreateEvent ( $ drop -> getDropzone ( ) , $ drop , $ document ) ) ; return $ document ; }
Creates a Document.

@param Drop  $drop
@param User  $user
@param int   $documentType
@param mixed $documentData

@return Document
Creates a Document .