class Resource (View source)

This class represents a jcr nt:resource and is used by the File document.

Properties

protected $id
protected NodeInterface $node
protected $nodename
protected $parent
protected $data
protected $mimeType
protected $encoding
protected $lastModified
protected $lastModifiedBy

Methods

string
getNodename()

The node name of the file.

$this
setNodename(string $name)

Set the node name of the resource.

object
getParentDocument()

The parent File document of this Resource document.

$this
setParentDocument(object $parent)

Set the parent document of this resource.

$this
setData(stream $data)

Set the data from a binary stream.

getData()

Get the binary data stream of this resource.

int
getSize()

Get the size of the stored data stream in this resource.

$this
setMimeType(string $mimeType)

Set the mime type information for this resource.

string
getMimeType()

Get the mime type information of this resource.

$this
setEncoding(string $encoding)

Set the encoding information for the data stream.

string|null
getEncoding()

Get the optional encoding information for the data stream.

$this
setLastModified(DateTime $lastModified)

Set the last modified date manually.

getLastModified()

Get the last modified date.

$this
setLastModifiedBy(string $lastModifiedBy)

Set the jcr username of the user that last modified this resource.

string
getLastModifiedBy()

Get the jcr username of the user that last modified this resource.

string
getMime()

Get mime type and encoding (RFC2045).

string
__toString()

String representation.

Details

string getNodename()

The node name of the file.

Return Value

string

$this setNodename(string $name)

Set the node name of the resource.

Only mutable on new document before the persist. For an nt:file resource child, this must be "jcr:content".

Parameters

string $name the name of the resource

Return Value

$this

object getParentDocument()

The parent File document of this Resource document.

Return Value

object File document that is the parent of this node.

$this setParentDocument(object $parent)

Set the parent document of this resource.

Parameters

object $parent Document that is the parent of this node.

Return Value

$this

$this setData(stream $data)

Set the data from a binary stream.

Parameters

stream $data the contents of this resource

Return Value

$this

getData()

Get the binary data stream of this resource.

int getSize()

Get the size of the stored data stream in this resource.

You should call this method instead of anything else to know the file size as PHPCR implementations are expected to be able to provide this information without needing to to load the actual data stream.

Do not use this right after updating data before flushing, as it will only look at the stored data.

Return Value

int the resource size in bytes.

$this setMimeType(string $mimeType)

Set the mime type information for this resource.

Parameters

string $mimeType

Return Value

$this

string getMimeType()

Get the mime type information of this resource.

Return Value

string

$this setEncoding(string $encoding)

Set the encoding information for the data stream.

Parameters

string $encoding

Return Value

$this

string|null getEncoding()

Get the optional encoding information for the data stream.

Return Value

string|null the encoding of this resource

$this setLastModified(DateTime $lastModified)

Set the last modified date manually.

This might be updated automatically by some PHPCR implementations, but it is not required by the specification.

Parameters

DateTime $lastModified

Return Value

$this

DateTime getLastModified()

Get the last modified date.

Return Value

DateTime

$this setLastModifiedBy(string $lastModifiedBy)

Set the jcr username of the user that last modified this resource.

This might be updated automatically by some PHPCR implementations, but it is not required by the specification.

Parameters

string $lastModifiedBy

Return Value

$this

string getLastModifiedBy()

Get the jcr username of the user that last modified this resource.

Return Value

string

string getMime()

Get mime type and encoding (RFC2045).

Return Value

string

string __toString()

String representation.

Return Value

string