webCOMAND

repo::get_objects_by_uuid()

Retrieve multiple objects from the repository by their UUID, optionally ensuring they match or extend a given content type.

Prototype

array get_objects_by_uuid(array $uuids, mixed $content_type = NULL)

Parameters

  • uuids - Array of Object UUIDs in binary, hex or string format.
  • content_type - Optional Content Type identified by a content type object, the Content Type numeric ID or string Identifier.

Return

An array of zero or more cObjects that match the specified UUIDs, and they are of or extend the content_type if specified.  If none or only some of the UUIDs have a match, only those that match will be returned.  Non-matching UUIDs or types will simply be ignored, so you may want to compare the count of the returned array to the count of uuids to verify all UUIDs match.

Example

$uuids = ['89a3603d-10f7-11e9-abc5-7368ad2cd4a1', '99a3603d-10f7-11e9-abc5-7368ad2cd4a1'];
$contacts = $repo->get_objects_by_uuid($uuids, 'Contact');
if(count($contacts) !== count($uuids) {
    echo("Some UUIDs or object types did not match.\n");
    exit();
}
foreach($contacts as $contact) {
    echo($contact->FirstName . " " . $contact->LastName . "\n");
}

Related

get_object_by_uuid(), get_objects_by_oid(), get_objects_by_doid(), get_objects_by_id(), get()