PHP Class Neos\Media\Domain\Model\Asset

It can be used as is to represent any asset for which no better match is available.
Inheritance: implements Neos\Media\Domain\Model\AssetInterface
Show file Open project: neos/neos-development-collection Class Usage Examples

Protected Properties

Property Type Description
$assetCollections Collection<\Neos\Media\Domain\Model\AssetCollection>
$assetRepository Neos\Media\Domain\Repository\AssetRepository
$assetService Neos\Media\Domain\Service\AssetService
$caption string
$lastModified DateTime
$persistenceManager Neos\Flow\Persistence\PersistenceManagerInterface
$resource Neos\Flow\ResourceManagement\PersistentResource
$resourceManager Neos\Flow\ResourceManagement\ResourceManager
$systemLogger Neos\Flow\Log\SystemLoggerInterface
$tags Collection<\Neos\Media\Domain\Model\Tag>
$thumbnailService Neos\Media\Domain\Service\ThumbnailService
$thumbnails Collection<\Neos\Media\Domain\Model\Thumbnail>
$title string

Public Methods

Method Description
__construct ( PersistentResource $resource ) Constructs an asset. The resource is set internally and then initialize() is called.
addTag ( Tag $tag ) : boolean Add a single tag to this asset
addThumbnail ( Thumbnail $thumbnail ) : void An internal method which adds a thumbnail which was generated by the ThumbnailService.
getAssetCollections ( ) : Doctrine\Common\Collections\Collection Return the asset collections this asset is included in
getCaption ( ) : string The caption of this asset
getFileExtension ( ) : string Returns a file extension fitting to the media type of this asset
getIdentifier ( ) : string
getLabel ( ) : string
getLastModified ( ) : DateTime Returns the last modification timestamp for this asset
getMediaType ( ) : string Returns the IANA media type of this asset
getResource ( ) : PersistentResource PersistentResource of the original file
getTags ( ) : Doctrine\Common\Collections\Collection Return the tags assigned to this asset
getThumbnail ( integer $maximumWidth = null, integer $maximumHeight = null, string $ratioMode = ImageInterface::RATIOMODE_INSET, boolean $allowUpScaling = null ) : Thumbnail Returns a thumbnail of this asset
getTitle ( ) : string The title of this image
getUsageCount ( ) : integer Returns the number of times the asset is in use.
initializeObject ( integer $initializationCause ) : void
isInUse ( ) : boolean Returns true if the asset is still in use.
refresh ( ) : void Refreshes this asset after the Resource or any other parameters affecting thumbnails have been modified
removeTag ( Tag $tag ) : boolean Remove a single tag from this asset
setAssetCollections ( Doctrine\Common\Collections\Collection $assetCollections ) : void Set the asset collections that include this asset
setCaption ( string $caption ) : void Sets the caption of this asset (optional)
setResource ( PersistentResource $resource ) : void Sets the asset resource and (re-)initializes the asset.
setTags ( Doctrine\Common\Collections\Collection $tags ) : void Set the tags assigned to this asset
setTitle ( string $title ) : void Sets the title of this image (optional)

Protected Methods

Method Description
emitAssetCreated ( Neos\Media\Domain\Model\AssetInterface $asset ) : void Signals that an asset was created.
initialize ( ) : void Override this to initialize upon instantiation.

Method Details

__construct() public method

Constructs an asset. The resource is set internally and then initialize() is called.
public __construct ( PersistentResource $resource )
$resource Neos\Flow\ResourceManagement\PersistentResource

addTag() public method

Add a single tag to this asset
public addTag ( Tag $tag ) : boolean
$tag Tag The tag to add
return boolean TRUE if the tag added was new, FALSE if it already existed

addThumbnail() public method

An internal method which adds a thumbnail which was generated by the ThumbnailService.
See also: getThumbnail()
public addThumbnail ( Thumbnail $thumbnail ) : void
$thumbnail Thumbnail
return void

emitAssetCreated() protected method

Signals that an asset was created.
Deprecation: Will be removed with next major version of Neos.Media. Use AssetService::emitAssetCreated signal instead.
protected emitAssetCreated ( Neos\Media\Domain\Model\AssetInterface $asset ) : void
$asset Neos\Media\Domain\Model\AssetInterface
return void

getAssetCollections() public method

Return the asset collections this asset is included in
public getAssetCollections ( ) : Doctrine\Common\Collections\Collection
return Doctrine\Common\Collections\Collection

getCaption() public method

The caption of this asset
public getCaption ( ) : string
return string

getFileExtension() public method

Returns a file extension fitting to the media type of this asset
public getFileExtension ( ) : string
return string

getIdentifier() public method

public getIdentifier ( ) : string
return string

getLabel() public method

public getLabel ( ) : string
return string

getLastModified() public method

Returns the last modification timestamp for this asset
public getLastModified ( ) : DateTime
return DateTime The date and time of last modification.

getMediaType() public method

Returns the IANA media type of this asset
public getMediaType ( ) : string
return string

getResource() public method

PersistentResource of the original file
public getResource ( ) : PersistentResource
return Neos\Flow\ResourceManagement\PersistentResource

getTags() public method

Return the tags assigned to this asset
public getTags ( ) : Doctrine\Common\Collections\Collection
return Doctrine\Common\Collections\Collection

getThumbnail() public method

If the maximum width / height is not specified or exceeds the original asset's dimensions, the width / height of the original asset is used.
public getThumbnail ( integer $maximumWidth = null, integer $maximumHeight = null, string $ratioMode = ImageInterface::RATIOMODE_INSET, boolean $allowUpScaling = null ) : Thumbnail
$maximumWidth integer The thumbnail's maximum width in pixels
$maximumHeight integer The thumbnail's maximum height in pixels
$ratioMode string Whether the resulting image should be cropped if both edge's sizes are supplied that would hurt the aspect ratio
$allowUpScaling boolean Whether the resulting image should be upscaled
return Thumbnail

getTitle() public method

The title of this image
public getTitle ( ) : string
return string

getUsageCount() public method

Returns the number of times the asset is in use.
public getUsageCount ( ) : integer
return integer

initialize() protected method

Override this to initialize upon instantiation.
protected initialize ( ) : void
return void

initializeObject() public method

public initializeObject ( integer $initializationCause ) : void
$initializationCause integer
return void

isInUse() public method

Returns true if the asset is still in use.
public isInUse ( ) : boolean
return boolean

refresh() public method

Refreshes this asset after the Resource or any other parameters affecting thumbnails have been modified
public refresh ( ) : void
return void

removeTag() public method

Remove a single tag from this asset
public removeTag ( Tag $tag ) : boolean
$tag Tag
return boolean

setAssetCollections() public method

Set the asset collections that include this asset
public setAssetCollections ( Doctrine\Common\Collections\Collection $assetCollections ) : void
$assetCollections Doctrine\Common\Collections\Collection
return void

setCaption() public method

Sets the caption of this asset (optional)
public setCaption ( string $caption ) : void
$caption string
return void

setResource() public method

Sets the asset resource and (re-)initializes the asset.
public setResource ( PersistentResource $resource ) : void
$resource Neos\Flow\ResourceManagement\PersistentResource
return void

setTags() public method

Set the tags assigned to this asset
public setTags ( Doctrine\Common\Collections\Collection $tags ) : void
$tags Doctrine\Common\Collections\Collection
return void

setTitle() public method

Sets the title of this image (optional)
public setTitle ( string $title ) : void
$title string
return void

Property Details

$assetCollections protected property

protected Collection<\Neos\Media\Domain\Model\AssetCollection> $assetCollections
return Collection<\Neos\Media\Domain\Model\AssetCollection>

$assetRepository protected property

protected AssetRepository,Neos\Media\Domain\Repository $assetRepository
return Neos\Media\Domain\Repository\AssetRepository

$assetService protected property

protected AssetService,Neos\Media\Domain\Service $assetService
return Neos\Media\Domain\Service\AssetService

$caption protected property

protected string $caption
return string

$lastModified protected property

protected DateTime $lastModified
return DateTime

$persistenceManager protected property

protected PersistenceManagerInterface,Neos\Flow\Persistence $persistenceManager
return Neos\Flow\Persistence\PersistenceManagerInterface

$resource protected property

protected PersistentResource,Neos\Flow\ResourceManagement $resource
return Neos\Flow\ResourceManagement\PersistentResource

$resourceManager protected property

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

$systemLogger protected property

protected SystemLoggerInterface,Neos\Flow\Log $systemLogger
return Neos\Flow\Log\SystemLoggerInterface

$tags protected property

protected Collection<\Neos\Media\Domain\Model\Tag> $tags
return Collection<\Neos\Media\Domain\Model\Tag>

$thumbnailService protected property

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

$thumbnails protected property

protected Collection<\Neos\Media\Domain\Model\Thumbnail> $thumbnails
return Collection<\Neos\Media\Domain\Model\Thumbnail>

$title protected property

protected string $title
return string