Locking a node places a lock on the node. If successful, the node is said to hold the lock. If the node is already locked, a LockException is thrown:
<?php
//get a node to lock
$node = $session->getItem('pcr:root/foo');
try {
$node->lock();
} catch (Exception $e) {
//the node is locked
}
try {
$node->setProperty('bar', true); //will throw LockException
} catch (Exception $e) {
echo 'could not set property (node locked)';
}
//unlock the node
$node->unlock();
$node->setProperty('bar', true);
?>