PHP Class Neos\Flow\ResourceManagement\PersistentResource

Inheritance: implements Neos\Flow\ResourceManagement\ResourceMetaDataInterface, implements Neos\Cache\CacheAwareInterface
Mostrar archivo Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$collectionName string Name of a collection whose storage is used for storing this resource and whose target is used for publishing.
$deleted boolean An internal flag which tells if this PersistentResource object has been deleted during the current request
$environment Neos\Flow\Utility\Environment
$fileSize integer The size of this object's data
$filename string Filename which is used when the data of this resource is downloaded as a file or acting as a label
$lifecycleEventsActive boolean
$md5 string MD5 hash identifying the content attached to this resource
$mediaType string The IANA media type of this resource
$protected boolean As soon as the PersistentResource has been published, modifying this object is not allowed
$relativePublicationPath string An optional relative path which can be used by a publishing target for structuring resources into directories
$resourceManager ResourceManager
$sha1 string SHA1 hash identifying the content attached to this resource
$systemLogger Neos\Flow\Log\SystemLoggerInterface
$temporaryLocalCopyPathAndFilename string

Public Methods

Method Description
__toString ( ) : string Returns the SHA1 of the content this PersistentResource is related to
createTemporaryLocalCopy ( ) : string Returns the path to a local file representing this resource for use with read-only file operations such as reading or copying.
disableLifecycleEvents ( ) : void A very internal function which disables the Doctrine lifecycle events for this PersistentResource.
getCacheEntryIdentifier ( ) : string Returns a string which distinctly identifies this object and thus can be used as an identifier for cache entries related to this object. Introduced through the CacheAwareInterface.
getCollectionName ( ) : string Returns the name of the collection this resource is part of
getFileExtension ( ) : string Returns the file extension used for this resource
getFileSize ( ) : integer Returns the size of the content of this resource
getFilename ( ) : string Gets the filename
getHash ( ) : string Returns the sha1 hash of the content of this resource
getMd5 ( ) : string Returns the MD5 hash of the content of this resource
getMediaType ( ) : string Returns the Media Type for this resource
getRelativePublicationPath ( ) : string Returns the relative publication path
getResourcePointer ( ) : ResourcePointer Returns the resource pointer
getSha1 ( ) : string Returns the SHA1 hash of the content of this resource
getStream ( ) : resource | boolean Returns a stream for use with read-only file operations such as reading or copying.
initializeObject ( integer $initializationCause ) : void Protects this PersistentResource if it has been persisted already.
isDeleted ( ) : boolean An internal method which tells if this PersistentResource object has been already deleted by the ResourceManager.
postPersist ( ) : void Doctrine lifecycle event callback which is triggered on "postPersist" events.
preRemove ( ) : void Doctrine lifecycle event callback which is triggered on "preRemove" events.
setCollectionName ( string $collectionName ) : void Sets the name of the collection this resource should be part of
setDeleted ( boolean $flag = true ) : void An internal method which marks the PersistentResource object as deleted.
setFileSize ( integer $fileSize ) : void Sets the size of the content of this resource
setFilename ( string $filename ) : void Sets the filename which is used when this resource is downloaded or saved as a file
setHash ( string $hash ) : void Sets the SHA1 hash of the content of this resource
setMd5 ( string $md5 ) : void Sets the MD5 hash of the content of this resource
setMediaType ( string $mediaType ) : void Explicitly sets the Media Type for this resource
setRelativePublicationPath ( string $path ) : void Sets a relative path which can be used by a publishing target for structuring resources into directories
setResourcePointer ( ResourcePointer $resourcePointer ) : void Sets the resource pointer
setSha1 ( string $sha1 ) : void Sets the SHA1 hash of the content of this resource
shutdownObject ( ) : void Takes care of removing a possibly existing temporary local copy on destruction of this object.

Protected Methods

Method Description
throwExceptionIfProtected ( ) : void Throws an exception if this PersistentResource object is protected against modifications.

Method Details

__toString() public method

Returns the SHA1 of the content this PersistentResource is related to
Deprecation: Since version 3.0. Use getSha1() to get a textual representation
public __toString ( ) : string
return string

createTemporaryLocalCopy() public method

Note that you must not store or publish file paths returned from this method as they will change with every request.
public createTemporaryLocalCopy ( ) : string
return string Absolute path and filename pointing to the temporary local copy of this resource

disableLifecycleEvents() public method

This is needed when some low-level operations need to be done, for example deleting a PersistentResource from the ResourceRepository without unpublishing the (probably not existing) data from the storage.
public disableLifecycleEvents ( ) : void
return void

getCacheEntryIdentifier() public method

Returns a string which distinctly identifies this object and thus can be used as an identifier for cache entries related to this object. Introduced through the CacheAwareInterface.
public getCacheEntryIdentifier ( ) : string
return string

getCollectionName() public method

Returns the name of the collection this resource is part of
public getCollectionName ( ) : string
return string Name of the collection, for example "persistentResources"

getFileExtension() public method

Returns the file extension used for this resource
public getFileExtension ( ) : string
return string The file extension used for this file

getFileSize() public method

Returns the size of the content of this resource
public getFileSize ( ) : integer
return integer The content size

getFilename() public method

Gets the filename
public getFilename ( ) : string
return string The filename

getHash() public method

Returns the sha1 hash of the content of this resource
Deprecation: Since version 3.0, please use getSha1() instead
public getHash ( ) : string
return string The sha1 hash

getMd5() public method

Returns the MD5 hash of the content of this resource
public getMd5 ( ) : string
return string The MD5 hash

getMediaType() public method

Returns the Media Type for this resource
public getMediaType ( ) : string
return string The IANA Media Type

getRelativePublicationPath() public method

Returns the relative publication path

getResourcePointer() public method

Deprecated – use getSha1() instead!
See also: getSha1()
Deprecation: Since version 3.0, use getSha1() which is the same value
public getResourcePointer ( ) : ResourcePointer
return ResourcePointer $resourcePointer

getSha1() public method

Returns the SHA1 hash of the content of this resource
public getSha1 ( ) : string
return string The sha1 hash

getStream() public method

Note: The caller is responsible to close the returned resource by calling fclose($stream)
public getStream ( ) : resource | boolean
return resource | boolean | boolean A stream which points to the data of this resource for read-access or FALSE if the stream could not be obtained

initializeObject() public method

Protects this PersistentResource if it has been persisted already.
public initializeObject ( integer $initializationCause ) : void
$initializationCause integer
return void

isDeleted() public method

An internal method which tells if this PersistentResource object has been already deleted by the ResourceManager.
public isDeleted ( ) : boolean
return boolean

postPersist() public method

This method triggers the publication of this resource.
public postPersist ( ) : void
return void

preRemove() public method

This method triggers the deletion of data related to this resource.
public preRemove ( ) : void
return void

setCollectionName() public method

Sets the name of the collection this resource should be part of
public setCollectionName ( string $collectionName ) : void
$collectionName string Name of the collection
return void

setDeleted() public method

This method is called by the ResourceManager in order to prevent other code parts, for example the Doctrine lifecycle events, to delete this resource again.
public setDeleted ( boolean $flag = true ) : void
$flag boolean
return void

setFileSize() public method

Sets the size of the content of this resource
public setFileSize ( integer $fileSize ) : void
$fileSize integer The content size
return void

setFilename() public method

Sets the filename which is used when this resource is downloaded or saved as a file
public setFilename ( string $filename ) : void
$filename string
return void

setHash() public method

Sets the SHA1 hash of the content of this resource
Deprecation: Since version 3.0, please use setSha1() instead
public setHash ( string $hash ) : void
$hash string The sha1 hash
return void

setMd5() public method

Sets the MD5 hash of the content of this resource
public setMd5 ( string $md5 ) : void
$md5 string The MD5 hash
return void

setMediaType() public method

Explicitly sets the Media Type for this resource
public setMediaType ( string $mediaType ) : void
$mediaType string The IANA Media Type
return void

setRelativePublicationPath() public method

Sets a relative path which can be used by a publishing target for structuring resources into directories
public setRelativePublicationPath ( string $path ) : void
$path string
return void

setResourcePointer() public method

Deprecated – use setSha1() instead!
See also: setSha1()
Deprecation: Since version 3.0, use setSha1() to set the raw hash of the resourcePointer
public setResourcePointer ( ResourcePointer $resourcePointer ) : void
$resourcePointer ResourcePointer
return void

setSha1() public method

Sets the SHA1 hash of the content of this resource
public setSha1 ( string $sha1 ) : void
$sha1 string The sha1 hash
return void

shutdownObject() public method

Note: we can't use __destruct() here because this would lead Doctrine to create a proxy method __destruct() which will run __load(), which in turn will trigger the SQL protection in Flow Security, which will then discover that a possibly previously existing session has been half-destroyed already (see FLOW-121).
public shutdownObject ( ) : void
return void

throwExceptionIfProtected() protected method

Throws an exception if this PersistentResource object is protected against modifications.
protected throwExceptionIfProtected ( ) : void
return void

Property Details

$collectionName protected_oe property

Name of a collection whose storage is used for storing this resource and whose target is used for publishing.
protected string $collectionName
return string

$deleted protected_oe property

An internal flag which tells if this PersistentResource object has been deleted during the current request
protected bool $deleted
return boolean

$environment protected_oe property

protected Environment,Neos\Flow\Utility $environment
return Neos\Flow\Utility\Environment

$fileSize protected_oe property

The size of this object's data
protected int $fileSize
return integer

$filename protected_oe property

Filename which is used when the data of this resource is downloaded as a file or acting as a label
protected string $filename
return string

$lifecycleEventsActive protected_oe property

protected bool $lifecycleEventsActive
return boolean

$md5 protected_oe property

MD5 hash identifying the content attached to this resource
protected string $md5
return string

$mediaType protected_oe property

The IANA media type of this resource
protected string $mediaType
return string

$protected protected_oe property

As soon as the PersistentResource has been published, modifying this object is not allowed
protected bool $protected
return boolean

$relativePublicationPath protected_oe property

An optional relative path which can be used by a publishing target for structuring resources into directories
protected string $relativePublicationPath
return string

$resourceManager protected_oe property

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

$sha1 protected_oe property

SHA1 hash identifying the content attached to this resource
protected string $sha1
return string

$systemLogger protected_oe property

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

$temporaryLocalCopyPathAndFilename protected_oe property

protected string $temporaryLocalCopyPathAndFilename
return string