PHP Class Neos\Flow\ResourceManagement\PersistentResource

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

Protected Properties

Свойство 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

Méthodes publiques

Méthode 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.

Méthodes protégées

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

Method Details

__toString() public méthode

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
Résultat string

createTemporaryLocalCopy() public méthode

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

disableLifecycleEvents() public méthode

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
Résultat void

getCacheEntryIdentifier() public méthode

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
Résultat string

getCollectionName() public méthode

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

getFileExtension() public méthode

Returns the file extension used for this resource
public getFileExtension ( ) : string
Résultat string The file extension used for this file

getFileSize() public méthode

Returns the size of the content of this resource
public getFileSize ( ) : integer
Résultat integer The content size

getFilename() public méthode

Gets the filename
public getFilename ( ) : string
Résultat string The filename

getHash() public méthode

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

getMd5() public méthode

Returns the MD5 hash of the content of this resource
public getMd5 ( ) : string
Résultat string The MD5 hash

getMediaType() public méthode

Returns the Media Type for this resource
public getMediaType ( ) : string
Résultat string The IANA Media Type

getRelativePublicationPath() public méthode

Returns the relative publication path
public getRelativePublicationPath ( ) : string
Résultat string

getResourcePointer() public méthode

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

getSha1() public méthode

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

getStream() public méthode

Note: The caller is responsible to close the returned resource by calling fclose($stream)
public getStream ( ) : resource | boolean
Résultat 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 méthode

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

isDeleted() public méthode

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

postPersist() public méthode

This method triggers the publication of this resource.
public postPersist ( ) : void
Résultat void

preRemove() public méthode

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

setCollectionName() public méthode

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

setDeleted() public méthode

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
Résultat void

setFileSize() public méthode

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

setFilename() public méthode

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

setHash() public méthode

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
Résultat void

setMd5() public méthode

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

setMediaType() public méthode

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

setRelativePublicationPath() public méthode

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

setResourcePointer() public méthode

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
Résultat void

setSha1() public méthode

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

shutdownObject() public méthode

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
Résultat void

throwExceptionIfProtected() protected méthode

Throws an exception if this PersistentResource object is protected against modifications.
protected throwExceptionIfProtected ( ) : void
Résultat 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
Résultat string

$deleted protected_oe property

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

$environment protected_oe property

protected Environment,Neos\Flow\Utility $environment
Résultat Neos\Flow\Utility\Environment

$fileSize protected_oe property

The size of this object's data
protected int $fileSize
Résultat 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
Résultat string

$lifecycleEventsActive protected_oe property

protected bool $lifecycleEventsActive
Résultat boolean

$md5 protected_oe property

MD5 hash identifying the content attached to this resource
protected string $md5
Résultat string

$mediaType protected_oe property

The IANA media type of this resource
protected string $mediaType
Résultat string

$protected protected_oe property

As soon as the PersistentResource has been published, modifying this object is not allowed
protected bool $protected
Résultat 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
Résultat string

$resourceManager protected_oe property

protected ResourceManager,Neos\Flow\ResourceManagement $resourceManager
Résultat ResourceManager

$sha1 protected_oe property

SHA1 hash identifying the content attached to this resource
protected string $sha1
Résultat string

$systemLogger protected_oe property

protected SystemLoggerInterface,Neos\Flow\Log $systemLogger
Résultat Neos\Flow\Log\SystemLoggerInterface

$temporaryLocalCopyPathAndFilename protected_oe property

protected string $temporaryLocalCopyPathAndFilename
Résultat string