- ⌂ 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::unlock_object()
Unlocks this object in the repository.
This method has no effect (and will return TRUE) if the user does not already possess the lock in this session.
Prototype
bool unlock_object(array $options = [])
Parameters
- options - Associative array of key/value pairs with the following recognized keys.
- User - The User (object) to lock on behalf of. If not provided, the current "user of record" for the object's repository connection will be used.
- Comment - An optional comment to apply to the lock as it is unlocked.
Return
TRUE if the lock was successfully released, otherwise FALSE.
Example
$repo = comand::repo();
$user = $repo->get_first('FROM User WHERE Username='admin' LIMIT 1');
$contact = $repo->get_first('FROM Contact LIMIT 1');
$locked = $contact->lock_object([
'Timeout' => 3, // wait up to 3 seconds to get lock
'User' => $user, // lock on behalf of admin user
]);
if(!$locked) {
echo("Could not get lock.\n");
exit();
}
$contact->LastName = 'New Name';
$contact->approve();
$contact->unlock_object([
'User' => $user, // unlock on behalf of admin user
]);
Related