- ⌂ 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_object()
Get a single object from the repository and ensure it is or extends a PHP Class or content type.
Passing in an OID or UUID is more efficient than a cPath and cQL, and than calling get_first() because it doesn't need to be interpreted as a query, and more importantly it will leverage the repository object cache.
Prototype
object get_object(mixed $value, mixed $class = '\\comand\\models\\cObject')
Parameters
- value - An OID, UUID, cPath, cQL or cObject. If a cObject is specified, it will only be returned if its content type is or extends the specified class.
- class - A PHP class that is or extends cObject, a string that represents the fully namespaced path to the same, or a Content Type Identifier.
Return
An object that matches the value or query and is or extends the specified class or content type. Otherwise NULL.
Example
$contact = $repo->get_object(12345, 'Contact');
if($contact != NULL) {
echo($contact->Name . " - " . $contact->Phone . "\n");
}