- ⌂ cObject
- Methods
- Constructor
- add_variant()
- approve()
- as_array()
- can_add_variant()
- can_delete_variant()
- can_edit_variant()
- can_reorder_variant()
- clone()
- delete()
- edit_variant()
- enum()
- get_active_object()
- get_all_variants()
- get_attributes()
- get_dimensions()
- get_dimension_with()
- get_parent()
- get_primary_cpath()
- get_variant()
- Keywords()
- lock_object()
- reload_data()
- repo()
- revert()
- save()
- store()
- unlock_object()
- update_from_array()
- validate()
cObject::get_attributes()
Returns attributes associated with this object; that is, a collection of objects that reference this object via forward references.
Prototype
collection get_attributes(mixed $content_type = NULL, mixed $field = NULL, boolean $polymorphic = TRUE)
Parameters
- content_type - Optional content type of the objects to return. It may be provided as an Identifier, ID, OID, DOID, UUID or Content Type. If not specified, objects of any content type that reference this object will be included in the collection.
- field - Optional field that refers to the content type's forward reference field. It may be provided as an Identifier, ID, OID, DOID, UUID or Content Type Field. If not specified, objects that reference this object via any forward reference field will be included in the collection.
- polymorphic - If TRUE (default), attributes that are sub-types of the given content type will be returned, otherwise only objects of the given content type will be returned (strict).
Return
Returns a collection of objects that reference this object via forward references that meet the criteria provided in the parameters.
Example
$repo = \comand::repo();
$contact = $repo->get_first('FROM Contact');
// get all contacts this contact is an Emergency Contact for
$attributes = $contact->get_attributes('Contact', 'EmergencyContact');
foreach($attributes as $attribute) {
echo("$contact is an emergency contact for $attribute\n");
}