Collection
in package
implements
JsonSerializable
Represents an ArangoDB collection
Tags
Table of Contents
Interfaces
- JsonSerializable
Methods
- __construct() : mixed
- Collection constructor.
- __get() : mixed|null
- Get some attribute
- __set() : mixed
- Set a attribute
- __toString() : string
- Return an string representation of document
- addIndex() : bool
- Create a 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 a index of collection
- findByKey() : Document|false
- Find a document by it's 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
- load() : bool
- Loads the collection on server
- 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
Methods
__construct()
Collection constructor.
public
__construct(string $name, Database $database[, array<string|int, mixed> $attributes = [] ]) : mixed
Parameters
- $name : string
- $database : Database
- $attributes : array<string|int, mixed> = []
Tags
__get()
Get some attribute
public
__get(string $name) : mixed|null
Parameters
- $name : string
Return values
mixed|null__set()
Set a attribute
public
__set(string $name, mixed $value) : mixed
Parameters
- $name : string
- $value : mixed
Tags
__toString()
Return an string representation of document
public
__toString() : string
Return values
stringaddIndex()
Create a index for collection
public
addIndex(IndexInterface $index) : bool
Parameters
- $index : IndexInterface
Tags
Return values
boolall()
Returns a cursor for access all documents on this Collection
public
all() : CursorInterface|bool
Tags
Return values
CursorInterface|bool —Cursor if collection exists on database. False otherwise.
count()
Return the number of documents in a collection.
public
count() : int
Tags
Return values
int —Total count of documents on collection.
drop()
Drops the collection on database
public
drop() : bool
Tags
Return values
booldropIndex()
Drops a index of collection
public
dropIndex(IndexInterface $index) : bool
Parameters
- $index : IndexInterface
Tags
Return values
boolfindByKey()
Find a document by it's key
public
findByKey(string $key[, bool $isVertex = false ]) : Document|false
Parameters
- $key : string
-
Document key
- $isVertex : bool = false
-
If the collection is a vertex in a graph, passing true will return document as Vertex object.
Tags
Return values
Document|falsegetAttributes()
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
Return values
stringgetDatabase()
Returns the database where collection belongs
public
getDatabase() : Database
Return values
DatabasegetGloballyUniqueId()
Return the globally Unique ID of collection
public
getGloballyUniqueId() : string
Return values
stringgetId()
Return the ID of collection
public
getId() : string|null
Return values
string|null —String if collection exists on database. Null if not.
getIndexes()
Return all indexes of collection
public
getIndexes() : ArrayList
Tags
Return values
ArrayListgetName()
Return the name of collection
public
getName() : string
Return values
stringgetRevision()
Return the revision of collection
public
getRevision() : string
Tags
Return values
stringgetStatus()
Return the status of collection
public
getStatus() : int
Return values
int —A integer between 0 and 6
getStatusDescription()
Return a string description of status
public
getStatusDescription() : string
Return values
stringgetType()
Return the collection type
public
getType() : string
Return values
stringisGraph()
Return if the collection is a graph collection
public
isGraph() : bool
Return values
boolisNew()
Returns true if is a new object
public
isNew() : bool
Return values
boolisSystem()
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
load()
Loads the collection on server
public
load([bool $count = true ]) : bool
Parameters
- $count : bool = true
Tags
Return values
boolrecalculateCount()
Recalculates the document count of a collection, if it ever becomes inconsistent.
public
recalculateCount() : bool
Tags
Return values
boolrename()
Renames the collection
public
rename(string $newName) : bool
Parameters
- $newName : string
-
The new name of collection.
Tags
Return values
boolsave()
Saves or update the collection.
public
save() : bool
Except for 'waitForSync', 'journalSize' and 'name', a collection can not be modified after creation. For change 'name', the method 'rename' must be used.
Tags
Return values
boolsetAttributes()
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>truncate()
Truncate the collection
public
truncate() : bool