- ⌂ cObject
- Methods
- Constructor
- add_variant()
- approve()
- as_array()
- can_add_variant()
- can_delete_variant()
- can_edit_variant()
- can_reorder_variant()
- clone()
- delete()
- edit_variant()
- enum()
- get_active_object()
- get_all_variants()
- get_attributes()
- get_dimensions()
- get_dimension_with()
- get_parent()
- get_primary_cpath()
- get_variant()
- Keywords()
- lock_object()
- reload_data()
- repo()
- revert()
- save()
- store()
- unlock_object()
- update_from_array()
- validate()
cObject::get_parent()
Retrieves the parent object if this object is an embedded object. If it is NOT an embedded object, returns NULL.
Prototype
cObject get_parent(boolean $bTop = FALSE, boolean $bSelf = FALSE, boolean $instanceof = NULL)
Parameters
- bTop - Whether to recurse to first object that is NOT an embedded object - i.e. the primary top-level object.
- bSelf - Whether to return this object instance if it is not embedded in any other.
- instanceof - Optional Content Type of parent. If provided, multiple parents will be traversed until a parent of the specified type is found.
Return
Returns the parent object if this object is an embedded object. Otherwise, returns NULL.
Example
$repo = \comand::repo();
$contact = $repo->get_first('FROM Contact');
$parent = $contact->get_parent();
if($parent) {
echo("Parent=$parent");
} else {
echo("Object is not embedded.");
}