webCOMAND

cObject::get_active_object()

Returns the active/approved version of this object.  If this is an object (aka it extends cObject instead of Content), the object itself will be returned because cObjects do not support versions.  If it is the approved version, then it will return itself as well.  If no active/approved version is available (only a working or draft versions exist), NULL will be returned.

Prototype

cObject get_active_object()

Return

Returns the active/approved version of this object.  If this is an object (aka it extends cObject instead of Content), the object itself will be returned because cObjects do not support versions.  If it is the approved version, then it will return itself as well.  If no active/approved version is available (only a working or draft versions exist), NULL will be returned.

Example

$repo = \comand::repo();
$contact = $repo->get_first('FROM Contact');

// get all contacts this contact is an Emergency Contact for
$active = $contact->get_active_object();
echo("The approved version of this contact is $active.\n");