Documentation

DataObject extends AbstractResource
in package

Objects are the basic storage entities in Cloud Files. They represent the files and their optional metadata you upload to the system. When you upload objects to Cloud Files, the data is stored as-is (without compression or encryption) and consists of a location (container), the object's name, and any metadata you assign consisting of key/value pairs.

Table of Contents

GLOBAL_METADATA_PREFIX  = 'X'
METADATA_LABEL  = 'Object'
PATCH_CONTENT_TYPE  = OpenCloudCommonConstantsMime::JSON_PATCH
$aliases  : array<string|int, mixed>
The aliases configure for the properties of the instance.
$content  : EntityBody
$contentLength  : The
$contentType  : string
$directory  : bool
$etag  : string
$lastModified  : string
$manifest  : string
$metadata  : Metadata
$metadataClass  : string
$name  : The
$service  : ServiceInterface
$container  : Container
$logger  : LoggerInterface
The logger instance
$properties  : array<string|int, mixed>
Holds all the properties added by overloading.
__call()  : mixed
Intercept non-existent method calls for dynamic getter/setter functionality.
__construct()  : mixed
Also need to set Container parent and handle pseudo-directories.
appendToMetadata()  : array<string|int, mixed>
Append a particular array of values to the existing metadata. Analogous to a merge. You must call to actually persist the metadata using the ObjectStore service.
checkJsonError()  : mixed
Checks the most recent JSON operation for errors.
copy()  : Response
createSymlinkFrom()  : DataObject
Create a symlink to this object from another named object. Requires the other object to either not exist or be empty.
createSymlinkTo()  : Response
Create a symlink to another named object from this object. Requires this object to be empty.
delete()  : mixed
fromResponse()  : AbstractResource
Factory method that allows for easy instantiation from a Response object.
generateUuid()  : mixed
getCdnService()  : Service
For internal use only.
getClient()  : Client
For internal use only.
getContainer()  : Container
getContent()  : EntityBody
getContentLength()  : mixed
getContentType()  : null|string
getDirectory()  : bool
getEtag()  : null|string
getInstance()  : static
getLastModified()  : mixed
getLogger()  : LoggerInterface
Returns the Logger object.
getManifest()  : null|string
getMetadata()  : Metadata
Returns metadata for this object.
getName()  : string
getPublicUrl()  : bool|Url
getService()  : Service
For internal use only.
getTemporaryUrl()  : string
Get a temporary URL for this object.
getUrl()  : mixed
hasLogger()  : bool
isDirectory()  : bool
makeResourceIteratorOptions()  : mixed
populate()  : mixed
A collection list of DataObjects contains a different data structure than the one returned for the "Retrieve Object" operation. So we need to stock the values differently.
populateFromResponse()  : $this
Takes a response and stocks common values from both the body and the headers.
primaryKeyField()  : mixed
purge()  : mixed
Remove this object from the CDN.
refresh()  : mixed
retrieveMetadata()  : Metadata
Retrieve metadata from the API. This method will then set and return this value.
saveMetadata()  : Response
Push local metadata to the API, thereby executing a permanent save.
setContainer()  : $this
setContent()  : $this
setContentLength()  : $this
setContentType()  : $this
setDirectory()  : $this
setEtag()  : $this
setLastModified()  : mixed
setLogger()  : $this
Sets the logger.
setMetadata()  : AbstractResource
Set the metadata (local-only) for this object. You must call saveMetadata to actually persist the metadata using the ObjectStore service.
setName()  : $this
stockHeaders()  : array<string|int, mixed>
Prepend/stock the header names with a resource-specific prefix.
stripNamespace()  : mixed
toCamel()  : mixed
Convert a string to camelCase format.
toUnderscores()  : mixed
Convert string to underscore format.
trimHeaders()  : array<string|int, mixed>
Trim headers of their resource-specific prefixes.
unsetMetadataItem()  : Response
To delete or unset a particular metadata item.
update()  : mixed
url()  : mixed
getJsonHeader()  : mixed
getManifestHeader()  : null|string
getPatchHeaders()  : mixed
getProperty()  : mixed
Grab value out of the data array.
headerIsValidMetadata()  : mixed
propertyExists()  : bool
Basic check to see whether property exists.
setManifest()  : $this
setProperty()  : mixed
We can set a property under three conditions:
stripPrefix()  : mixed
Strip an individual header name of its resource-specific prefix.
checkAttributePrefix()  : bool
Checks the attribute $property and only permits it if the prefix is in the specified $prefixes array
isAccessible()  : bool
Does the property exist in the object variable list (i.e. does it have public or protected visibility?)

Constants

METADATA_LABEL

public mixed METADATA_LABEL = 'Object'

PATCH_CONTENT_TYPE

public mixed PATCH_CONTENT_TYPE = OpenCloudCommonConstantsMime::JSON_PATCH

Properties

$aliases

The aliases configure for the properties of the instance.

protected array<string|int, mixed> $aliases = array()

$contentLength

protected The $contentLength

size of this object.

$contentType

protected string $contentType

The object's content type

$lastModified

protected string $lastModified

Date of last modification.

$manifest

protected string $manifest = false

Manifest. Can be null so we use false to mean unset.

$metadataClass

protected string $metadataClass = 'OpenCloud\Common\Metadata'

The FQCN of the metadata object used for the container.

$name

protected The $name

file name of the object

$properties

Holds all the properties added by overloading.

private array<string|int, mixed> $properties = array()

Methods

__call()

Intercept non-existent method calls for dynamic getter/setter functionality.

public __call( $method,  $args) : mixed
Parameters
$method :
$args :
Tags
throws
RuntimeException
Return values
mixed

__construct()

Also need to set Container parent and handle pseudo-directories.

public __construct(Container $container[, null $data = null ]) : mixed
Parameters
$container : Container
$data : null = null
Return values
mixed

appendToMetadata()

Append a particular array of values to the existing metadata. Analogous to a merge. You must call to actually persist the metadata using the ObjectStore service.

public appendToMetadata(array<string|int, mixed> $values) : array<string|int, mixed>
Parameters
$values : array<string|int, mixed>

The array of values you want to append to metadata.

Return values
array<string|int, mixed>

Metadata, after $values are appended.

checkJsonError()

Checks the most recent JSON operation for errors.

public static checkJsonError() : mixed
Tags
throws
JsonError
codeCoverageIgnore
Return values
mixed

copy()

public copy(string $destination) : Response
Parameters
$destination : string

Path (`container/object') of new object

Return values
Response

createSymlinkFrom()

Create a symlink to this object from another named object. Requires the other object to either not exist or be empty.

public createSymlinkFrom(string $source) : DataObject
Parameters
$source : string

Path (`container/object') of other object to symlink this object from

Tags
throws
NoNameError

if a source name is not provided

throws
ObjectNotEmptyException

if object already exists and is not empty

Return values
DataObject

The symlinked object

createSymlinkTo()

Create a symlink to another named object from this object. Requires this object to be empty.

public createSymlinkTo(string $destination) : Response
Parameters
$destination : string

Path (`container/object') of other object to symlink this object to

Tags
throws
NoNameError

if a destination name is not provided

throws
ObjectNotEmptyException

if $this is not an empty object

Return values
Response

The response

delete()

public delete([mixed $params = array() ]) : mixed
Parameters
$params : mixed = array()
Return values
mixed

generateUuid()

public static generateUuid() : mixed
Return values
mixed

getCdnService()

For internal use only.

public getCdnService() : Service
Return values
Service

The CDN version of the ObjectStore service associated with this ObjectStore resource.

getClient()

For internal use only.

public getClient() : Client
Return values
Client

The HTTP client associated with the associated ObjectStore service.

getContentLength()

public getContentLength() : mixed
Return values
mixed

getContentType()

public getContentType() : null|string
Return values
null|string

getDirectory()

public getDirectory() : bool
Return values
bool

getEtag()

public getEtag() : null|string
Return values
null|string

getInstance()

public static getInstance() : static
Return values
static

getLastModified()

public getLastModified() : mixed
Return values
mixed

getManifest()

public getManifest() : null|string
Return values
null|string

Path (`container/object') from X-Object-Manifest header or null if the header does not exist

getName()

public getName() : string
Return values
string

getPublicUrl()

public getPublicUrl([string $type = UrlType::CDN ]) : bool|Url
Parameters
$type : string = UrlType::CDN
Return values
bool|Url

getService()

For internal use only.

public getService() : Service
Return values
Service

The ObjectStore service associated with this ObjectStore resource.

getTemporaryUrl()

Get a temporary URL for this object.

public getTemporaryUrl(int $expires, string $method[, bool $forcePublicUrl = false ]) : string
Parameters
$expires : int

Expiration time in seconds

$method : string

What method can use this URL? (GET' or PUT')

$forcePublicUrl : bool = false

If set to TRUE, a public URL will always be used. The default is to use whatever URL type the user has set for the main service.

Tags
link
http://docs.rackspace.com/files/api/v1/cf-devguide/content/TempURL-d1a4450.html
throws
InvalidArgumentError
throws
ObjectError
Return values
string

getUrl()

public getUrl([mixed $path = null ][, array<string|int, mixed> $params = array() ]) : mixed
Parameters
$path : mixed = null
$params : array<string|int, mixed> = array()
Return values
mixed

hasLogger()

public hasLogger() : bool
Return values
bool

isDirectory()

public isDirectory() : bool
Return values
bool

Is this data object a pseudo-directory?

makeResourceIteratorOptions()

public makeResourceIteratorOptions(mixed $resource) : mixed
Parameters
$resource : mixed
Return values
mixed

populate()

A collection list of DataObjects contains a different data structure than the one returned for the "Retrieve Object" operation. So we need to stock the values differently.

public populate(mixed $info[, mixed $setObjects = true ]) : mixed
Parameters
$info : mixed
$setObjects : mixed = true
Return values
mixed

populateFromResponse()

Takes a response and stocks common values from both the body and the headers.

public populateFromResponse(Response $response) : $this
Parameters
$response : Response
Return values
$this

primaryKeyField()

public primaryKeyField() : mixed
Return values
mixed

purge()

Remove this object from the CDN.

public purge([null $email = null ]) : mixed
Parameters
$email : null = null
Return values
mixed

refresh()

public refresh() : mixed
Return values
mixed

retrieveMetadata()

Retrieve metadata from the API. This method will then set and return this value.

public retrieveMetadata() : Metadata
Return values
Metadata

Metadata returned from the ObjectStore service for this object/container.

saveMetadata()

Push local metadata to the API, thereby executing a permanent save.

public saveMetadata(array<string|int, mixed> $metadata[, bool $stockPrefix = true ]) : Response
Parameters
$metadata : array<string|int, mixed>

The array of values you want to set as metadata

$stockPrefix : bool = true

Whether to prepend each array key with the metadata-specific prefix. For objects, this would be X-Object-Meta-Foo => Bar

Return values
Response

HTTP response from API operation.

setContent()

public setContent(mixed $content) : $this
Parameters
$content : mixed
Return values
$this

setContentLength()

public setContentLength( $contentLength) : $this
Parameters
$contentLength :

mixed

Return values
$this

setContentType()

public setContentType(string $contentType) : $this
Parameters
$contentType : string
Return values
$this

setDirectory()

public setDirectory( $directory) : $this
Parameters
$directory :

bool

Return values
$this

setEtag()

public setEtag( $etag) : $this
Parameters
$etag :
Return values
$this

setLastModified()

public setLastModified(mixed $lastModified) : mixed
Parameters
$lastModified : mixed
Return values
mixed

setMetadata()

Set the metadata (local-only) for this object. You must call saveMetadata to actually persist the metadata using the ObjectStore service.

public setMetadata(array<string|int, mixed> $data[, bool $constructFromResponse = false ]) : AbstractResource
Parameters
$data : array<string|int, mixed>

Object/container metadata key/value pair array.

$constructFromResponse : bool = false

Whether the metadata key/value pairs were obtiained from an HTTP response of an ObjectStore API operation.

Return values
AbstractResource

This object, with metadata set.

setName()

public setName( $name) : $this
Parameters
$name :

string

Return values
$this

stockHeaders()

Prepend/stock the header names with a resource-specific prefix.

public static stockHeaders(array<string|int, mixed> $headers) : array<string|int, mixed>
Parameters
$headers : array<string|int, mixed>

Headers to use on ObjectStore resource.

Return values
array<string|int, mixed>

Headers returned with appropriate prefix as expected by ObjectStore service.

stripNamespace()

public stripNamespace(mixed $namespace) : mixed
Parameters
$namespace : mixed
Return values
mixed

toCamel()

Convert a string to camelCase format.

public toCamel( $string[, bool $capitalise = true ]) : mixed
Parameters
$string :
$capitalise : bool = true

Optional flag which allows for word capitalization.

Return values
mixed

toUnderscores()

Convert string to underscore format.

public toUnderscores( $string) : mixed
Parameters
$string :
Return values
mixed

trimHeaders()

Trim headers of their resource-specific prefixes.

public static trimHeaders(array<string|int, mixed> $headers) : array<string|int, mixed>

For internal use only.

Parameters
$headers : array<string|int, mixed>

Headers as returned from an HTTP response

Return values
array<string|int, mixed>

Trimmed headers

unsetMetadataItem()

To delete or unset a particular metadata item.

public unsetMetadataItem( $key) : Response
Parameters
$key :

Metadata key to unset

Return values
Response

HTTP response returned from API operation to unset metadata item.

update()

public update([mixed $params = array() ]) : mixed
Parameters
$params : mixed = array()
Return values
mixed

url()

public url([mixed $path = null ][, array<string|int, mixed> $query = array() ]) : mixed
Parameters
$path : mixed = null
$query : array<string|int, mixed> = array()
Tags
deprecated
Return values
mixed

getJsonHeader()

protected static getJsonHeader() : mixed
Return values
mixed

getManifestHeader()

protected getManifestHeader() : null|string
Return values
null|string

getPatchHeaders()

protected static getPatchHeaders() : mixed
Return values
mixed

getProperty()

Grab value out of the data array.

protected getProperty(string $property) : mixed
Parameters
$property : string
Return values
mixed

headerIsValidMetadata()

protected static headerIsValidMetadata(mixed $header) : mixed
Parameters
$header : mixed
Return values
mixed

propertyExists()

Basic check to see whether property exists.

protected propertyExists(string $property[, bool $allowRetry = true ]) : bool
Parameters
$property : string

The property name being investigated.

$allowRetry : bool = true

If set to TRUE, the check will try to format the name in underscores because there are sometimes discrepancies between camelCaseNames and underscore_names.

Return values
bool

setManifest()

protected setManifest(string $manifest) : $this
Parameters
$manifest : string

Path (`container/object') to set as the value to X-Object-Manifest

Return values
$this

setProperty()

We can set a property under three conditions:

protected setProperty(mixed $property, mixed $value) : mixed
  1. If it has a concrete setter: setProperty()
  2. If the property exists
  3. If the property name's prefix is in an approved list
Parameters
$property : mixed
$value : mixed
Return values
mixed

stripPrefix()

Strip an individual header name of its resource-specific prefix.

protected static stripPrefix( $header) : mixed
Parameters
$header :
Return values
mixed

checkAttributePrefix()

Checks the attribute $property and only permits it if the prefix is in the specified $prefixes array

private checkAttributePrefix(string $property) : bool

This is to support extension namespaces in some services.

Parameters
$property : string

the name of the attribute

Return values
bool

isAccessible()

Does the property exist in the object variable list (i.e. does it have public or protected visibility?)

private isAccessible( $property) : bool
Parameters
$property :
Return values
bool

Search results