PHP Class Sulu\Bundle\MediaBundle\Media\Manager\MediaManager

Inheritance: implements Sulu\Bundle\MediaBundle\Media\Manager\MediaManagerInterface
显示文件 Open project: sulu/sulu Class Usage Examples

Public Properties

Property Type Description
$count integer

Protected Properties

Property Type Description
$categoryRepository Sulu\Bundle\CategoryBundle\Entity\CategoryRepositoryInterface
$collectionRepository Sulu\Bundle\MediaBundle\Entity\CollectionRepository The repository for communication with the database.
$mediaRepository Sulu\Bundle\MediaBundle\Entity\MediaRepositoryInterface The repository for communication with the database.
$storage Sulu\Bundle\MediaBundle\Media\Storage\StorageInterface
$typeManager Sulu\Bundle\MediaBundle\Media\TypeManager\TypeManagerInterface

Public Methods

Method Description
__construct ( Sulu\Bundle\MediaBundle\Entity\MediaRepositoryInterface $mediaRepository, Sulu\Bundle\MediaBundle\Entity\CollectionRepositoryInterface $collectionRepository, Sulu\Component\Security\Authentication\UserRepositoryInterface $userRepository, Sulu\Bundle\CategoryBundle\Entity\CategoryRepositoryInterface $categoryRepository, EntityManager $em, Sulu\Bundle\MediaBundle\Media\Storage\StorageInterface $storage, Sulu\Bundle\MediaBundle\Media\FileValidator\FileValidatorInterface $validator, Sulu\Bundle\MediaBundle\Media\FormatManager\FormatManagerInterface $formatManager, Sulu\Bundle\TagBundle\Tag\TagManagerInterface $tagManager, Sulu\Bundle\MediaBundle\Media\TypeManager\TypeManagerInterface $typeManager, Sulu\Component\PHPCR\PathCleanupInterface $pathCleaner, Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface $tokenStorage = null, Sulu\Component\Security\Authorization\SecurityCheckerInterface $securityChecker = null, FFMpeg\FFProbe $ffprobe, array $permissions, string $downloadPath, string $maxFileSize )
addFormatsAndUrl ( Media $media ) : Media
delete ( $id, $checkSecurity = false )
get ( $locale, $filter = [], $limit = null, $offset = null )
getById ( $id, $locale )
getByIds ( array $ids, $locale )
getCollectionById ( $collectionId ) : object
getCount ( )
getEntityById ( $id )
getFormatUrls ( $ids, $locale )
getUrl ( $id, $fileName, $version )
increaseDownloadCounter ( $fileVersionId )
move ( $id, $locale, $destCollection )
save ( $uploadedFile, $data, $userId )

Protected Methods

Method Description
createMedia ( $data, $user ) : Media Create a new media.
getCurrentUser ( ) : Sulu\Component\Security\Authentication\UserInterface | void Returns current user or null if no user is loggedin.
getUser ( $userId ) : Sulu\Component\Security\Authentication\UserInterface Returns a user for a given user-id.
setDataToMedia ( Media $media, $data, Sulu\Component\Security\Authentication\UserInterface $user ) : Media Data can be set over by array.

Private Methods

Method Description
buildData ( Symfony\Component\HttpFoundation\File\UploadedFile $uploadedFile, array $data, Sulu\Component\Security\Authentication\UserInterface $user ) : Media Prepares data.
getNormalizedFileName ( $originalFileName ) : string Returns file name without special characters and preserves file extension.
getProperties ( Symfony\Component\HttpFoundation\File\UploadedFile $uploadedFile ) : array
modifyMedia ( Symfony\Component\HttpFoundation\File\UploadedFile $uploadedFile, $data, Sulu\Component\Security\Authentication\UserInterface $user ) : Media Modifies an existing media.

Method Details

__construct() public method

public __construct ( Sulu\Bundle\MediaBundle\Entity\MediaRepositoryInterface $mediaRepository, Sulu\Bundle\MediaBundle\Entity\CollectionRepositoryInterface $collectionRepository, Sulu\Component\Security\Authentication\UserRepositoryInterface $userRepository, Sulu\Bundle\CategoryBundle\Entity\CategoryRepositoryInterface $categoryRepository, EntityManager $em, Sulu\Bundle\MediaBundle\Media\Storage\StorageInterface $storage, Sulu\Bundle\MediaBundle\Media\FileValidator\FileValidatorInterface $validator, Sulu\Bundle\MediaBundle\Media\FormatManager\FormatManagerInterface $formatManager, Sulu\Bundle\TagBundle\Tag\TagManagerInterface $tagManager, Sulu\Bundle\MediaBundle\Media\TypeManager\TypeManagerInterface $typeManager, Sulu\Component\PHPCR\PathCleanupInterface $pathCleaner, Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface $tokenStorage = null, Sulu\Component\Security\Authorization\SecurityCheckerInterface $securityChecker = null, FFMpeg\FFProbe $ffprobe, array $permissions, string $downloadPath, string $maxFileSize )
$mediaRepository Sulu\Bundle\MediaBundle\Entity\MediaRepositoryInterface
$collectionRepository Sulu\Bundle\MediaBundle\Entity\CollectionRepositoryInterface
$userRepository Sulu\Component\Security\Authentication\UserRepositoryInterface
$categoryRepository Sulu\Bundle\CategoryBundle\Entity\CategoryRepositoryInterface
$em Doctrine\ORM\EntityManager
$storage Sulu\Bundle\MediaBundle\Media\Storage\StorageInterface
$validator Sulu\Bundle\MediaBundle\Media\FileValidator\FileValidatorInterface
$formatManager Sulu\Bundle\MediaBundle\Media\FormatManager\FormatManagerInterface
$tagManager Sulu\Bundle\TagBundle\Tag\TagManagerInterface
$typeManager Sulu\Bundle\MediaBundle\Media\TypeManager\TypeManagerInterface
$pathCleaner Sulu\Component\PHPCR\PathCleanupInterface
$tokenStorage Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface
$securityChecker Sulu\Component\Security\Authorization\SecurityCheckerInterface
$ffprobe FFMpeg\FFProbe
$permissions array
$downloadPath string
$maxFileSize string

addFormatsAndUrl() public method

public addFormatsAndUrl ( Media $media ) : Media
$media Sulu\Bundle\MediaBundle\Api\Media
return Sulu\Bundle\MediaBundle\Api\Media

createMedia() protected method

Create a new media.
protected createMedia ( $data, $user ) : Media
$data
$user
return Sulu\Bundle\MediaBundle\Api\Media

delete() public method

public delete ( $id, $checkSecurity = false )

get() public method

public get ( $locale, $filter = [], $limit = null, $offset = null )

getById() public method

public getById ( $id, $locale )

getByIds() public method

public getByIds ( array $ids, $locale )
$ids array

getCollectionById() public method

public getCollectionById ( $collectionId ) : object
$collectionId
return object

getCount() public method

public getCount ( )

getCurrentUser() protected method

Returns current user or null if no user is loggedin.
protected getCurrentUser ( ) : Sulu\Component\Security\Authentication\UserInterface | void
return Sulu\Component\Security\Authentication\UserInterface | void

getEntityById() public method

public getEntityById ( $id )

getFormatUrls() public method

public getFormatUrls ( $ids, $locale )

getUrl() public method

public getUrl ( $id, $fileName, $version )

getUser() protected method

Returns a user for a given user-id.
protected getUser ( $userId ) : Sulu\Component\Security\Authentication\UserInterface
$userId
return Sulu\Component\Security\Authentication\UserInterface

increaseDownloadCounter() public method

public increaseDownloadCounter ( $fileVersionId )

move() public method

public move ( $id, $locale, $destCollection )

save() public method

public save ( $uploadedFile, $data, $userId )

setDataToMedia() protected method

Data can be set over by array.
protected setDataToMedia ( Media $media, $data, Sulu\Component\Security\Authentication\UserInterface $user ) : Media
$media Sulu\Bundle\MediaBundle\Api\Media
$data
$user Sulu\Component\Security\Authentication\UserInterface
return Sulu\Bundle\MediaBundle\Api\Media

Property Details

$categoryRepository protected_oe property

protected CategoryRepositoryInterface,Sulu\Bundle\CategoryBundle\Entity $categoryRepository
return Sulu\Bundle\CategoryBundle\Entity\CategoryRepositoryInterface

$collectionRepository protected_oe property

The repository for communication with the database.
protected CollectionRepository,Sulu\Bundle\MediaBundle\Entity $collectionRepository
return Sulu\Bundle\MediaBundle\Entity\CollectionRepository

$count public_oe property

public int $count
return integer

$mediaRepository protected_oe property

The repository for communication with the database.
protected MediaRepositoryInterface,Sulu\Bundle\MediaBundle\Entity $mediaRepository
return Sulu\Bundle\MediaBundle\Entity\MediaRepositoryInterface

$storage protected_oe property

protected StorageInterface,Sulu\Bundle\MediaBundle\Media\Storage $storage
return Sulu\Bundle\MediaBundle\Media\Storage\StorageInterface

$typeManager protected_oe property

protected TypeManagerInterface,Sulu\Bundle\MediaBundle\Media\TypeManager $typeManager
return Sulu\Bundle\MediaBundle\Media\TypeManager\TypeManagerInterface