src/Sulu/Bundle/MediaBundle/Media/Manager/MediaManager.php
private function buildData($uploadedFile, $data, $user)
    {
        if (!($uploadedFile instanceof UploadedFile)) {
            throw new InvalidFileException('Given uploaded file is not of instance UploadedFile');
        }

        $this->validator->validate($uploadedFile);

        $data['storageOptions'] = $this->storage->save(
            $uploadedFile->getPathname(),
            $this->getNormalizedFileName($uploadedFile->getClientOriginalName())
        );

        $data['name'] = $uploadedFile->getClientOriginalName();
        $data['size'] = $uploadedFile->getSize();
        $data['mimeType'] = $uploadedFile->getMimeType();
        $data['properties'] = $this->getProperties($uploadedFile);
        $data['type'] = [
            'id' => $this->typeManager->getMediaType($uploadedFile->getMimeType()),
        ];

        return $this->createMedia($data, $user);
    }
private function buildData($uploadedFile, $data, $user)
    {
        if (!($uploadedFile instanceof UploadedFile)) {
            throw new InvalidFileException('Given uploaded file is not of instance UploadedFile');
        }

        $this->validator->validate($uploadedFile);

        $data['storageOptions'] = $this->storage->save(
            $uploadedFile->getPathname(),
            $this->getNormalizedFileName($uploadedFile->getClientOriginalName())
        );

        $data['name'] = $uploadedFile->getClientOriginalName();
        $data['size'] = $uploadedFile->getSize();
        $data['mimeType'] = $uploadedFile->getMimeType();
        $data['properties'] = $this->getProperties($uploadedFile);
        $data['type'] = [
            'id' => $this->typeManager->getMediaType($uploadedFile->getMimeType()),
        ];

        return $this->createMedia($data, $user);
    }
private function buildData ( $ uploadedFile , $ data , $ user ) { if ( ! ( $ uploadedFile instanceof UploadedFile ) ) { throw new InvalidFileException ( 'Given uploaded file is not of instance UploadedFile' ) ; } $ this -> validator -> validate ( $ uploadedFile ) ; $ data [ 'storageOptions' ] = $ this -> storage -> save ( $ uploadedFile -> getPathname ( ) , $ this -> getNormalizedFileName ( $ uploadedFile -> getClientOriginalName ( ) ) ) ; $ data [ 'name' ] = $ uploadedFile -> getClientOriginalName ( ) ; $ data [ 'size' ] = $ uploadedFile -> getSize ( ) ; $ data [ 'mimeType' ] = $ uploadedFile -> getMimeType ( ) ; $ data [ 'properties' ] = $ this -> getProperties ( $ uploadedFile ) ; $ data [ 'type' ] = [ 'id' => $ this -> typeManager -> getMediaType ( $ uploadedFile -> getMimeType ( ) ) , ] ; return $ this -> createMedia ( $ data , $ user ) ; }
Prepares data.

@param UploadedFile $uploadedFile
@param array $data
@param UserInterface $user

@return Media

@throws InvalidFileException
Prepares data .