SimPCoRe
 
Home
Installation

Working with Nodes



Advanced

Tutorial - Working with Nodes

Locking Nodes

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);
?>
 

SimPCoRe
Home | Tutorials and Installation Instructions | Documentation | Download | Contact Us | Google Group