- ⌂ 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::as_array()
Return an associative array where the key is the object field Identifier and the value is the field value.
Only data type (ContentTypeField::is_data_type()) and reference (ContentTypeField::is_reference_type()) fields are included by default, but either can be excluded with the options.
Prototype
array as_array(array $options = [])
Parameters
- options - associative array of zero or more of the following options.
- include_data - Include data type fields. Default is TRUE.
- include_refs - Include reference fields. Default is TRUE.
Return
Associative array of field/value pairs.
Example
$repo = \comand::repo();
$contact = $repo->get_first('FROM Contact LIMIT 1');
$fields = $contact->as_array(['include_refs' => FALSE]);
foreach($fields as $field => $value) {
echo("$field = $value\n");
}