webCOMAND

repo::get_object_by_id()

Retrieve an object from the repository by it's ID and Content Type.

Prototype

cObject get_object_by_id(integer $id, mixed $content_type)

Parameters

  • id - Object ID.
  • content_type - The Content Type identified by the content type object or the Content Type Identifier as a string.

Return

The cObject if a matching object is found.  Otherwise, NULL.

Examples

Content Type Identifier Example

$contact = $repo->get_object_by_id(123, "Contact');
if($contact !== NULL) {
    echo($contact->Name . " - " . $contact->Phone . "\n");
}

Content Type Object Example

$ct = $repo->get_first("FROM ContentType WHERE Identifier='Contact'");
$contact = $repo->get_object_by_id(123, $ct);
if($contact !== NULL) {
    echo($contact->Name . " - " . $contact->Phone . "\n");
}

Related

get_objects_by_id(), get_object_by_oid(), get_object_by_doid(), get_object_by_uuid()