webCOMAND

repo::get_object_by_doid()

Retrieve an object from the repository by it's DOID, optionally ensuring it is or extends a given content type.

Prototype

cObject get_object_by_doid(integer $doid, mixed $content_type = NULL)

Parameters

  • oid - Object DOID.
  • content_type - Optional Content Type identified by a content type object, the Content Type numeric ID or string Identifier.

Return

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

Example

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

Related

get_objects_by_doid(), get_object_by_oid(), get_object_by_uuid(), get_object_by_id(), get_object(), get_first()