public
triagens\ArangoDb\Document
|
#
get( string $collection, mixed $documentId, array $options = [] )
Get a single document from a collection
Get a single document from a collection
Alias method for getById()
Parameters
- $collection
- collection id as a string or number
- $documentId
- $options
- optional, array of options
Options are :
- '_includeInternals' - true to include the internal attributes. Defaults to false
- '_ignoreHiddenAttributes' - true to show hidden attributes. Defaults to false
- 'revision' - the documents revision
- 'ifMatch' - boolean if given revision should match or not
Returns
Throws
|
public
boolean
|
#
has( string $collection, mixed $documentId )
Check if a document exists
Check if a document exists
This will call self::get() internally and checks if there
was an exception thrown which represents an 404 request.
Parameters
- $collection
- collection id as a string or number
- $documentId
Returns
boolean
Throws
|
public
triagens\ArangoDb\Document
|
#
getById( string $collection, mixed $documentId, array $options = [] )
Get a single document from a collection
Get a single document from a collection
This will throw if the document cannot be fetched from the server.
Parameters
- $collection
- collection id as a string or number
- $documentId
- $options
- optional, array of options
Options are :
- '_includeInternals' - true to include the internal attributes. Defaults to false
- '_ignoreHiddenAttributes' - true to show hidden attributes. Defaults to false
- 'ifMatch' - boolean if given revision should match or not
- 'revision' - The document is returned if it matches/not matches revision.
Returns
Throws
|
public
array
|
#
getHead( string $collection, mixed $documentId, boolean $revision = null, string $ifMatch = null )
Gets information about a single documents from a collection
Gets information about a single documents from a collection
This will throw if the document cannot be fetched from the server
Parameters
- $collection
- collection id as a string or number.
- $documentId
- $revision
- $ifMatch - boolean if given revision should match or not.
- $ifMatch
- $revision - The document is returned if it matches/not matches revision.
Returns
array
- an array containing the complete header including the key httpCode.
Throws
|
protected
triagens\ArangoDb\Document
|
#
createFromArrayWithContext( $data, $options )
Intermediate function to call the createFromArray function from the right context
Intermediate function to call the createFromArray function from the right context
Parameters
Returns
Throws
|
public
mixed
|
#
store( triagens\ArangoDb\Document $document, mixed $collection = null, array $options = [] )
Store a document to a collection
Store a document to a collection
This is an alias/shortcut to save() and replace(). Instead of having to determine which of the 3 functions to use,
simply pass the document to store() and it will figure out which one to call.
This will throw if the document cannot be saved or replaced.
Parameters
- $document
- the document to be added, can be passed as a document or an array
- $collection
- collection id as string or number
- $options
- optional, array of options
Options are :
- 'createCollection' - create the collection if it does not yet exist.
- 'waitForSync' - if set to true, then all removal operations will instantly be synchronised to disk / If this is not specified, then the collection's default sync behavior will be applied.
Returns
Throws
Since
1.0
|
public
mixed
|
#
save( mixed $collection, triagens\ArangoDb\Document |array $document, array $options = [] )
save a document to a collection
save a document to a collection
This will add the document to the collection and return the document's id
This will throw if the document cannot be saved
Parameters
- $collection
- collection id as string or number
- $document
- the document to be added, can be passed as a document or an array
- $options
- optional, array of options
Options are :
- 'createCollection' - create the collection if it does not yet exist.
- 'waitForSync' - if set to true, then all removal operations will instantly be synchronised to disk / If this is not specified, then the collection's default sync behavior will be applied.
Returns
Throws
Since
1.0
|
public
boolean
|
#
update( triagens\ArangoDb\Document $document, array $options = [] )
Update an existing document in a collection, identified by the including _id and optionally _rev in the patch document.
Attention - The behavior of this method has changed since version 1.1
Update an existing document in a collection, identified by the including _id and optionally _rev in the patch document.
Attention - The behavior of this method has changed since version 1.1
This will update the document on the server
This will throw if the document cannot be updated
If policy is set to error (locally or globally through the ConnectionOptions)
and the passed document has a _rev value set, the database will check
that the revision of the document to-be-replaced is the same as the one given.
Parameters
- $document
- The patch document that will update the document in question
- $options
- optional, array of options
Options are :
- 'policy' - update policy to be used in case of conflict ('error', 'last' or NULL [use default])
- 'keepNull' - can be used to instruct ArangoDB to delete existing attributes instead setting their values to null. Defaults to true (keep attributes when set to null)
- 'waitForSync' - can be used to force synchronisation of the document update operation to disk even in case that the waitForSync flag had been disabled for the entire collection
Returns
boolean
- always true, will throw if there is an error
Throws
|
public
boolean
|
#
updateById( string $collection, mixed $documentId, triagens\ArangoDb\Document $document, array $options = [] )
Update an existing document in a collection, identified by collection id and document id
Attention - The behavior of this method has changed since version 1.1
Update an existing document in a collection, identified by collection id and document id
Attention - The behavior of this method has changed since version 1.1
This will update the document on the server
This will throw if the document cannot be updated
If policy is set to error (locally or globally through the ConnectionOptions)
and the passed document has a _rev value set, the database will check
that the revision of the document to-be-updated is the same as the one given.
Parameters
- $collection
- collection id as string or number
- $documentId
- document id as string or number
- $document
- patch document which contains the attributes and values to be updated
- $options
- optional, array of options
Options are :
- 'policy' - update policy to be used in case of conflict ('error', 'last' or NULL [use default])
- 'keepNull' - can be used to instruct ArangoDB to delete existing attributes instead setting their values to null. Defaults to true (keep attributes when set to null)
- 'waitForSync' - can be used to force synchronisation of the document update operation to disk even in case that the waitForSync flag had been disabled for the entire collection
Returns
boolean
- always true, will throw if there is an error
Throws
|
public
boolean
|
#
replace( triagens\ArangoDb\Document $document, array $options = [] )
Replace an existing document in a collection, identified by the document itself
Replace an existing document in a collection, identified by the document itself
This will update the document on the server
This will throw if the document cannot be updated
If policy is set to error (locally or globally through the ConnectionOptions)
and the passed document has a _rev value set, the database will check
that the revision of the to-be-replaced document is the same as the one given.
Parameters
- $document
- $options
- optional, array of options
Options are :
- 'policy' - update policy to be used in case of conflict ('error', 'last' or NULL [use default])
- 'waitForSync' - can be used to force synchronisation of the document update operation to disk even in case that the waitForSync flag had been disabled for the entire collection
Returns
boolean
- always true, will throw if there is an error
Throws
|
public
boolean
|
#
replaceById( mixed $collection, mixed $documentId, triagens\ArangoDb\Document $document, array $options = [] )
Replace an existing document in a collection, identified by collection id and document id
Replace an existing document in a collection, identified by collection id and document id
This will update the document on the server
This will throw if the document cannot be Replaced
If policy is set to error (locally or globally through the ConnectionOptions)
and the passed document has a _rev value set, the database will check
that the revision of the to-be-replaced document is the same as the one given.
Parameters
- $collection
- collection id as string or number
- $documentId
- document id as string or number
- $document
- $options
- optional, array of options
Options are :
- 'policy' - update policy to be used in case of conflict ('error', 'last' or NULL [use default])
- 'waitForSync' - can be used to force synchronisation of the document replacement operation to disk even in case that the waitForSync flag had been disabled for the entire collection
Returns
boolean
- always true, will throw if there is an error
Throws
|
public
boolean
|
#
remove( triagens\ArangoDb\Document $document, array $options = [] )
Remove a document from a collection, identified by the document itself
Remove a document from a collection, identified by the document itself
Parameters
- $document
- $options
- optional, array of options
Options are :
- 'policy' - update policy to be used in case of conflict ('error', 'last' or NULL [use default])
- 'waitForSync' - can be used to force synchronisation of the document removal operation to disk even in case that the waitForSync flag had been disabled for the entire collection
Returns
boolean
- always true, will throw if there is an error
Throws
|
public
boolean
|
#
removeById( mixed $collection, mixed $documentId, mixed $revision = null, array $options = [] )
Remove a document from a collection, identified by the collection id and document id
Remove a document from a collection, identified by the collection id and document id
Parameters
- $collection
- collection id as string or number
- $documentId
- document id as string or number
- $revision
- optional revision of the document to be deleted
- $options
- optional, array of options
Options are :
- 'policy' - update policy to be used in case of conflict ('error', 'last' or NULL [use default])
- 'waitForSync' - can be used to force synchronisation of the document removal operation to disk even in case that the waitForSync flag had been disabled for the entire collection
Returns
boolean
- always true, will throw if there is an error
Throws
|
protected
|
#
createCollectionIfOptions( $collection, array $options )
Parameters
- $collection
- collection name or id
- $options
- optional, array of options
Options are :
- 'createCollection' - true to create the collection if it does not exist
- 'createCollectionType' - "document" or 2 for document collection
- "edge" or 3 for edge collection
|