Arango PHP ODM

Collection
in package
implements JsonSerializable uses IndexableTrait

Represents an ArangoDB collection

Tags
author

Lucas S. Vieira

Table of Contents

Interfaces

JsonSerializable

Properties

$attributes  : array<string|int, mixed>
Attributes of collection
$connection  : Connection
Connection object
$database  : Database
Database object
$deletedStatus  : int
Deleted status of collection
$descriptorAttributes  : array<string|int, mixed>
Fields to be set directly
$isNew  : bool
If the collection is a new one or a representation of an existing collection on server
$loadedStatus  : int
Loaded status of collection
$loadingStatus  : int
Loading status of collection
$statusStrings  : array<string|int, mixed>
Status descriptions
$typeStrings  : array<string|int, mixed>
Type descriptions
$unknownStatus  : int
Unknown status of collection
$unloadedStatus  : int
Unloaded status of collection
$unloadingStatus  : int
Unloading status of collection
$defaults  : array<string|int, mixed>
Default values when creating collections

Methods

__construct()  : mixed
Collection constructor.
__get()  : mixed|null
Get some attribute
__set()  : mixed
Set an attribute
__toString()  : string
Return a string representation of document
addIndex()  : bool
Create an index for collection
all()  : CursorInterface|bool
Returns a cursor for access all documents on this Collection
count()  : int
Return the number of documents in a collection.
drop()  : bool
Drops the collection on database
dropIndex()  : bool
Drops an index of collection
findByKey()  : Document|false
Find a document by its key
getAttributes()  : array<string|int, mixed>
Return the collection attributes on array
getChecksum()  : string
Return the checksum of collection metadata
getDatabase()  : Database
Returns the database where collection belongs
getGloballyUniqueId()  : string
Return the globally Unique ID of collection
getId()  : string|null
Return the ID of collection
getIndexes()  : ArrayList
Return all indexes of collection
getName()  : string
Return the name of collection
getRevision()  : string
Return the revision of collection
getStatus()  : int
Return the status of collection
getStatusDescription()  : string
Return a string description of status
getType()  : string
Return the collection type
isGraph()  : bool
Return if the collection is a graph collection
isNew()  : bool
Returns true if is a new object
isSystem()  : bool
Checks if the collection is a system collection
jsonSerialize()  : mixed
recalculateCount()  : bool
Recalculates the document count of a collection, if it ever becomes inconsistent.
rename()  : bool
Renames the collection
save()  : bool
Saves or update the collection.
setAttributes()  : void
Set collection attributes
toArray()  : array<string|int, mixed>
Return an array representation of collection
truncate()  : bool
Truncate the collection
getCreateParameters()  : array<string|int, mixed>
Return only fields to be sent on a POST request
getUpdateParameters()  : array<string|int, mixed>
Return only fields to update this collection.
update()  : bool
Update collection.

Properties

$attributes

Attributes of collection

protected array<string|int, mixed> $attributes

$deletedStatus

Deleted status of collection

protected static int $deletedStatus = 5

$descriptorAttributes

Fields to be set directly

protected array<string|int, mixed> $descriptorAttributes = ['id' => null, 'objectId' => null, 'name' => '', 'type' => 2, 'status' => 0, 'cacheEnabled' => false, 'isSystem' => false, 'globallyUniqueId' => '', 'revision' => 0, 'count' => 0, 'checksum' => '']

$isNew

If the collection is a new one or a representation of an existing collection on server

protected bool $isNew

$loadedStatus

Loaded status of collection

protected static int $loadedStatus = 3

$loadingStatus

Loading status of collection

protected static int $loadingStatus = 6

$statusStrings

Status descriptions

protected array<string|int, mixed> $statusStrings = [0 => 'unknown', 1 => 'unknown', 2 => 'unloaded', 3 => 'loaded', 4 => 'unloading', 5 => 'deleted', 6 => 'loading']

$typeStrings

Type descriptions

protected array<string|int, mixed> $typeStrings = [2 => 'document', 3 => 'graph']

$unknownStatus

Unknown status of collection

protected static int $unknownStatus = 1

$unloadedStatus

Unloaded status of collection

protected static int $unloadedStatus = 2

$unloadingStatus

Unloading status of collection

protected static int $unloadingStatus = 4

$defaults

Default values when creating collections

private array<string|int, mixed> $defaults = ['replicationFactor' => 1, 'waitForSync' => false, 'shardingStrategy' => 'community-compat', 'shardKeys' => ["_key"], 'numberOfShards' => 1, 'isSystem' => false, 'type' => 2, 'keyOptions' => ['allowUserKeys' => true, 'type' => \ArangoDB\Collection\KeyType::TRADITIONAL]]

Methods

__get()

Get some attribute

public __get(string $name) : mixed|null
Parameters
$name : string
Return values
mixed|null

__set()

Set an attribute

public __set(string $name, mixed $value) : mixed
Parameters
$name : string
$value : mixed
Tags
throws
Exception

__toString()

Return a string representation of document

public __toString() : string
Return values
string

count()

Return the number of documents in a collection.

public count() : int
Tags
throws
DatabaseException|GuzzleException
Return values
int

Total count of documents on collection.

getAttributes()

Return the collection attributes on array

public getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

getChecksum()

Return the checksum of collection metadata

public getChecksum() : string
Tags
throws
DatabaseException|GuzzleException
Return values
string

getGloballyUniqueId()

Return the globally Unique ID of collection

public getGloballyUniqueId() : string
Return values
string

getId()

Return the ID of collection

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

String if collection exists on database. Null if not.

getName()

Return the name of collection

public getName() : string
Return values
string

getRevision()

Return the revision of collection

public getRevision() : string
Tags
throws
DatabaseException|GuzzleException
Return values
string

getStatus()

Return the status of collection

public getStatus() : int
Return values
int

An integer between 0 and 6

getStatusDescription()

Return a string description of status

public getStatusDescription() : string
Return values
string

getType()

Return the collection type

public getType() : string
Return values
string

isGraph()

Return if the collection is a graph collection

public isGraph() : bool
Return values
bool

isNew()

Returns true if is a new object

public isNew() : bool
Return values
bool

isSystem()

Checks if the collection is a system collection

public isSystem() : bool
Return values
bool

True if is a system collection. False otherwise.

jsonSerialize()

public jsonSerialize() : mixed
Tags
see
JsonSerializable::jsonSerialize

recalculateCount()

Recalculates the document count of a collection, if it ever becomes inconsistent.

public recalculateCount() : bool
Tags
throws
DatabaseException|GuzzleException
Return values
bool

rename()

Renames the collection

public rename(string $newName) : bool
Parameters
$newName : string

The new name of collection.

Tags
throws
DatabaseException|GuzzleException
Return values
bool

save()

Saves or update the collection.

public save() : bool

Except for 'waitForSync' and 'name', a collection can not be modified after creation. For change 'name', the method 'rename' must be used.

Tags
throws
DatabaseException|GuzzleException
Return values
bool

setAttributes()

Set collection attributes

public setAttributes(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>

toArray()

Return an array representation of collection

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCreateParameters()

Return only fields to be sent on a POST request

protected getCreateParameters() : array<string|int, mixed>
Return values
array<string|int, mixed>

getUpdateParameters()

Return only fields to update this collection.

protected getUpdateParameters() : array<string|int, mixed>
Tags
see
Collection::rename()
Return values
array<string|int, mixed>

update()

Update collection.

private update() : bool
Tags
throws
GuzzleException
Return values
bool

        
On this page

Search results