Beispiel #1
0
 /**
  * Updates or initialzes the metadata information of the current entity.
  *
  * @param FileDocument $file     Document to be used
  * @param integer      $fileSize Size of the uploaded file
  * @param array        $fileInfo Additional info about the file
  * @param FileDocument $fileData File data to be updated
  *
  * @return void
  */
 private function initOrUpdateMetaData(FileDocument $file, $fileSize, array $fileInfo, FileDocument $fileData = null)
 {
     if (empty($meta = $file->getMetadata()) && (empty($fileData) || empty($meta = $fileData->getMetadata()))) {
         $meta = $this->fileDocumentFactory->createFileMataData();
         $meta->setId($file->getId());
         $meta->setCreatedate(new \DateTime());
     }
     $meta->setModificationdate(new \DateTime());
     if (empty($meta->getFilename()) && !empty($fileInfo['data']['filename'])) {
         $meta->setFilename($fileInfo['data']['filename']);
     }
     if (!empty($fileInfo['data']['mimetype'])) {
         $meta->setMime($fileInfo['data']['mimetype']);
     }
     $meta->setSize($fileSize);
     $file->setMetadata($meta);
 }
 /**
  * @return void
  */
 public function testCreateFileMetadataAction()
 {
     $factory = new FileDocumentFactory();
     $this->assertInstanceOf('\\GravitonDyn\\FileBundle\\Document\\FileMetadataActionEmbedded', $factory->createFileMetadataAction());
 }