PHP Class Neos\Media\Domain\Service\AssetService

Show file Open project: neos/neos-development-collection Class Usage Examples

Protected Properties

Property Type Description
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
$packageManager Neos\Flow\Package\PackageManagerInterface
$reflectionService Neos\Flow\Reflection\ReflectionService
$resourceManager Neos\Flow\ResourceManagement\ResourceManager
$thumbnailService ThumbnailService
$uriBuilder Neos\Flow\Mvc\Routing\UriBuilder
$usageStrategies array

Public Methods

Method Description
emitAssetCreated ( Neos\Media\Domain\Model\AssetInterface $asset ) : void Signals that an asset was added.
emitAssetRemoved ( Neos\Media\Domain\Model\AssetInterface $asset ) : void Signals that an asset was removed.
emitAssetResourceReplaced ( Neos\Media\Domain\Model\AssetInterface $asset ) : void Signals that a resource on an asset has been replaced
emitAssetUpdated ( Neos\Media\Domain\Model\AssetInterface $asset ) : void Signals that an asset was updated.
getRepository ( Neos\Media\Domain\Model\AssetInterface $asset ) : Neos\Flow\Persistence\RepositoryInterface Returns the repository for an asset
getThumbnailUriAndSizeForAsset ( Neos\Media\Domain\Model\AssetInterface $asset, ThumbnailConfiguration $configuration, ActionRequest $request = null ) : array | null Calculates the dimensions of the thumbnail to be generated and returns the thumbnail URI.
getUsageCount ( Neos\Media\Domain\Model\AssetInterface $asset ) : integer Returns the total count of times an asset is used.
getUsageReferences ( Neos\Media\Domain\Model\AssetInterface $asset ) : array<\Neos\Media\Domain\Model\Dto\UsageReference> Returns an array of asset usage references.
isInUse ( Neos\Media\Domain\Model\AssetInterface $asset ) : boolean Returns true if the asset is used.
replaceAssetResource ( Neos\Media\Domain\Model\AssetInterface $asset, PersistentResource $resource, array $options = [] ) : void Replace resource on an asset. Takes variants and redirect handling into account.
validateRemoval ( Neos\Media\Domain\Model\AssetInterface $asset ) : void Validates if the asset can be removed

Protected Methods

Method Description
getUsageStrategies ( ) : array<\Neos\Media\Domain\Strategy\AssetUsageStrategyInterface> Returns all registered asset usage strategies

Method Details

emitAssetCreated() public method

Signals that an asset was added.
public emitAssetCreated ( Neos\Media\Domain\Model\AssetInterface $asset ) : void
$asset Neos\Media\Domain\Model\AssetInterface
return void

emitAssetRemoved() public method

Signals that an asset was removed.
public emitAssetRemoved ( Neos\Media\Domain\Model\AssetInterface $asset ) : void
$asset Neos\Media\Domain\Model\AssetInterface
return void

emitAssetResourceReplaced() public method

Signals that a resource on an asset has been replaced
public emitAssetResourceReplaced ( Neos\Media\Domain\Model\AssetInterface $asset ) : void
$asset Neos\Media\Domain\Model\AssetInterface
return void

emitAssetUpdated() public method

Signals that an asset was updated.
public emitAssetUpdated ( Neos\Media\Domain\Model\AssetInterface $asset ) : void
$asset Neos\Media\Domain\Model\AssetInterface
return void

getRepository() public method

Returns the repository for an asset
public getRepository ( Neos\Media\Domain\Model\AssetInterface $asset ) : Neos\Flow\Persistence\RepositoryInterface
$asset Neos\Media\Domain\Model\AssetInterface
return Neos\Flow\Persistence\RepositoryInterface

getThumbnailUriAndSizeForAsset() public method

In case of Images this is a thumbnail of the image, in case of other assets an icon representation.
public getThumbnailUriAndSizeForAsset ( Neos\Media\Domain\Model\AssetInterface $asset, ThumbnailConfiguration $configuration, ActionRequest $request = null ) : array | null
$asset Neos\Media\Domain\Model\AssetInterface
$configuration Neos\Media\Domain\Model\ThumbnailConfiguration
$request Neos\Flow\Mvc\ActionRequest Request argument must be provided for asynchronous thumbnails
return array | null Array with keys "width", "height" and "src" if the thumbnail generation work or null

getUsageCount() public method

Returns the total count of times an asset is used.
public getUsageCount ( Neos\Media\Domain\Model\AssetInterface $asset ) : integer
$asset Neos\Media\Domain\Model\AssetInterface
return integer

getUsageReferences() public method

Returns an array of asset usage references.
public getUsageReferences ( Neos\Media\Domain\Model\AssetInterface $asset ) : array<\Neos\Media\Domain\Model\Dto\UsageReference>
$asset Neos\Media\Domain\Model\AssetInterface
return array<\Neos\Media\Domain\Model\Dto\UsageReference>

getUsageStrategies() protected method

Returns all registered asset usage strategies
protected getUsageStrategies ( ) : array<\Neos\Media\Domain\Strategy\AssetUsageStrategyInterface>
return array<\Neos\Media\Domain\Strategy\AssetUsageStrategyInterface>

isInUse() public method

Returns true if the asset is used.
public isInUse ( Neos\Media\Domain\Model\AssetInterface $asset ) : boolean
$asset Neos\Media\Domain\Model\AssetInterface
return boolean

replaceAssetResource() public method

Replace resource on an asset. Takes variants and redirect handling into account.
public replaceAssetResource ( Neos\Media\Domain\Model\AssetInterface $asset, PersistentResource $resource, array $options = [] ) : void
$asset Neos\Media\Domain\Model\AssetInterface
$resource Neos\Flow\ResourceManagement\PersistentResource
$options array
return void

validateRemoval() public method

Validates if the asset can be removed
public validateRemoval ( Neos\Media\Domain\Model\AssetInterface $asset ) : void
$asset Neos\Media\Domain\Model\AssetInterface
return void

Property Details

$objectManager protected property

protected ObjectManagerInterface,Neos\Flow\ObjectManagement $objectManager
return Neos\Flow\ObjectManagement\ObjectManagerInterface

$packageManager protected property

protected PackageManagerInterface,Neos\Flow\Package $packageManager
return Neos\Flow\Package\PackageManagerInterface

$reflectionService protected property

protected ReflectionService,Neos\Flow\Reflection $reflectionService
return Neos\Flow\Reflection\ReflectionService

$resourceManager protected property

protected ResourceManager,Neos\Flow\ResourceManagement $resourceManager
return Neos\Flow\ResourceManagement\ResourceManager

$thumbnailService protected property

protected ThumbnailService,Neos\Media\Domain\Service $thumbnailService
return ThumbnailService

$uriBuilder protected property

protected UriBuilder,Neos\Flow\Mvc\Routing $uriBuilder
return Neos\Flow\Mvc\Routing\UriBuilder

$usageStrategies protected property

protected array $usageStrategies
return array