COMAND Collections are similar to arrays with some additional features.
COMAND Collections are like arrays and can be accessed and modified exactly like arrays in PHP code. This includes:
- access by index
- check with isset
- remove with unset
- append with 
- access number of items with count()
- iterate with foreach
For more information, see Collection in the Developer Reference.
COMAND Collections can be queried with cPath and cQL to filter the collection by certain criteria.
For more information, see Get Methods in the API Queries Tutorial.
A number of methods are available to check if a user is authorized to access the objects and object fields in a collection.
Additional information about the objects in a collection are also available.
- Distinct content types of all objects in the collection.
- Number of objects of each content type.
Additional methods are available to perform common tasks on collections.
- in_collection - check if an object is in a collection
- get_repository - get the repository that contains the collection and objects in the collection
- get_parent_object - get the object that contains this collection, when applicable
- get_parent_field - get the field of the parent object that contains this collection, when applicable
- load_object_fields - batch load one or more fields of objects in the collection
- get_common_content_type - find the closest inherited content type inherited by all objects in the collection (worst-case is Object)
- get_common_display_fields - find fields marked to display in summaries that are common to all objects in a collection
- unique - remove duplicate objects from the collection, leaving a collection of all unique objects
- get_unique_collection - same as unique, but returns the unique collection, leaving the original collection as-is.
- copy - copy a collection to another collection
- merge - merge two collections into a single collection, potentially allowing or filtering duplicates
- crop - remove objects from a collection outside of a specific index range
- as_array - convert the COMAND Collection to a standard PHP array of objects
- as_associative_array - convert the COMAND Collection to a standard PHP associative array of objects where the key is the value of a specific field
- field_values - convert to a standard PHP array with the value of a specific field from each object, with recursive hierarchy support
- reorder_object - change the position of an object from one index to another