Value object representing a single vertex document
package | ArangoDBClient |
---|---|
since | 1.2 |
inherited_from | \ArangoDBClient\Document |
__clone() : void
Returns the clone
magic |
---|
__construct(array $options = null
)
array
Options are :
__get(string $key) : mixed
This function is mapped to get() internally.
magic |
---|
string
mixed
- value of attribute, NULL if attribute is not set__isset(string $key) : boolean
string
boolean
returns true or false (set or not set)__set(string $key, mixed $value) : void
This is a magic method that allows the object to be used without declaring all document attributes first. This function is mapped to set() internally.
magic |
---|
string
mixed
\ArangoDBClient\ClientException |
---|
__toString() : string
It will not output hidden attributes.
Returns the document as JSON-encoded string
magic |
---|
string
- JSON-encoded document__unset($key)
Caution!!! This works only on the first array level. The preferred method to unset attributes in the database, is to set those to null and do an update() with the option: 'keepNull' => false.
magic |
---|
createFromArray(array $values, array $options = array()
) : \ArangoDBClient\Document | \ArangoDBClient\Edge | \ArangoDBClient\Graph
array
array
\ArangoDBClient\ClientException |
---|
\ArangoDBClient\Document
\ArangoDBClient\Edge
\ArangoDBClient\Graph
filterHiddenAttributes(array $attributes, array $_hiddenAttributes = array()
) : array
array
array
array
- attributes arrayget(string $key) : mixed
string
mixed
- value of attribute, NULL if attribute is not setgetAll(mixed $options = array()
) : array
mixed
Options are :
array
- array of all document attributes/valuesgetAllAsObject(mixed $options = array()
) : mixed
mixed
Options are :
mixed
- associative array of all document attributes/values, or an empty StdClass if the document
does not have anygetAllForInsertUpdate() : mixed
mixed
- associative array of all document attributes/valuesgetChanged() : boolean
boolean
- true if document was changed, false otherwisegetCollectionId() : mixed
Collection ids are generated on the server only. Collection ids are numeric but might be bigger than PHP_INT_MAX. To reliably store a collection id elsewhere, a PHP string should be used
mixed
- collection id, might be NULL if document does not yet have an idgetHandle() : string
Document handles are generated on the server only. Document handles consist of collection id and document id, in the format collectionId/documentId
string
- internal document id, might be NULL if document does not yet have an idgetHiddenAttributes() : array
array
$attributes - array of attributesgetId() : mixed
It is a string and consists of the collection's name and the document key (_key attribute) separated by /. Example: (collectionname/documentId)
The document handle is stored in a document's _id attribute.
mixed
- document id, might be NULL if document does not yet have an id.getInternalId() : string
Document ids are generated on the server only. Document ids consist of collection id and document id, in the format collectionId/documentId
string
- internal document id, might be NULL if document does not yet have an idgetInternalKey() : string
string
- internal document key, might be NULL if document does not yet have a keygetIsNew() : boolean
boolean
$isNew - flags if new or existing docgetKey() : mixed
Alias function for getInternalKey()
mixed
- document key, might be NULL if document does not yet have a keygetRevision() : mixed
mixed
- revision id, might be NULL if document does not yet have an idisIgnoreHiddenAttributes() : boolean
boolean
jsonSerialize(mixed $options = array()
) : array
mixed
Options are :
array
- array of all document attributes/valuesset(string $key, mixed $value) : void
The key (attribute name) must be a string. This will validate the value of the attribute and might throw an exception if the value is invalid.
string
mixed
\ArangoDBClient\ClientException |
---|
setChanged(boolean $value) : boolean
boolean
boolean
setHiddenAttributes(array $attributes) : void
array
setIgnoreHiddenAttributes(boolean $ignoreHiddenAttributes)
boolean
setInternalId(string $id) : void
This will throw if the id of an existing document gets updated to some other id
string
\ArangoDBClient\ClientException |
---|
setInternalKey(string $key) : void
This will throw if the key of an existing document gets updated to some other key
string
\ArangoDBClient\ClientException |
---|
setIsNew(boolean $isNew) : void
boolean
setRevision(mixed $rev) : void
Revision ids are generated on the server only.
Document ids are strings, even if they look "numeric" To reliably store a document id elsewhere, a PHP string must be used
mixed
toJson(array $options = array()
) : string
array
Options are :
string
- JSON-encoded documenttoSerialized(array $options = array()
) : string
array
Options are :
string
- PHP serialized document$_changed : boolean
false
$_doValidate : boolean
false
$_hiddenAttributes : array
array()
$_id : string
$_ignoreHiddenAttributes : boolean
false
$_isNew : boolean
true
$_key : string
$_rev : mixed
$_values : array
array()
ENTRY_HIDDENATTRIBUTES = '_hiddenAttributes'
ENTRY_ID = '_id'
ENTRY_IGNOREHIDDENATTRIBUTES = '_ignoreHiddenAttributes'
ENTRY_ISNEW = '_isNew'
ENTRY_KEY = '_key'
ENTRY_REV = '_rev'
KEY_REGEX_PART = '[a-zA-Z0-9_:.@\\-()+,=;$!*\'%]{1,254}'
OPTION_KEEPNULL = 'keepNull'
OPTION_POLICY = 'policy'
OPTION_WAIT_FOR_SYNC = 'waitForSync'