- ⌂ repo
- Methods
- Constructor
- execute()
- get()
- get_content_type()
- get_first()
- get_object()
- get_object_by_id()
- get_object_by_oid()
- get_object_by_doid()
- get_object_by_uuid()
- get_objects_by_id()
- get_objects_by_oid()
- get_objects_by_doid()
- get_objects_by_uuid()
- get_root()
- get_row()
- get_rows()
- get_system_property()
- log_alert()
- log_critical()
- log_to_file()
- log_to_html()
- new_collection()
- new_object()
- peek_user()
- pop_user()
- push_super_user()
- push_user()
- query()
- supports_dimensions()
- switch_user()
- uninit()
- with()
repo::get_objects_by_id()
Retrieve multiple objects of the same content type from the repository by their ID.
Prototype
array get_objects_by_id(array $ids, mixed $content_type)
Parameters
- ids - Array of Object IDs.
- content_type - The Content Type identified by the content type object or the Content Type Identifier as a string.
Return
An array of zero or more cObjects that match the specified IDs and content_type. If none or only some of the IDs have a match, only those that match will be returned. Non-matching IDs will simply be ignored, so you may want to compare the count of the returned array to the count of ids to verify all IDs match.
Example
$ids = [123, 456];
$contacts = $repo->get_objects_by_id($ids, 'Contact');
if(count($contacts) !== count($ids) {
echo("Some IDs did not match\n");
exit();
}
foreach($contacts as $contact) {
echo($contact->FirstName . " " . $contact->LastName . "\n");
}
Related
get_object_by_id(), get_objects_by_oid(), get_objects_by_doid(), get_objects_by_uuid(), get()