regarding how to reference another node

2 views
Skip to first unread message

lando

unread,
Sep 23, 2010, 2:08:27 PM9/23/10
to SimPCoRe
im confused as to how i would reference another node. is this so
content isn't duplicated?

$node->addNode( "pcr:reference=>pcr:root/etc/etc" );

please a little help im using simpcore to for a project at work and im
a little stuck.

Sammy

unread,
Sep 23, 2010, 4:24:41 PM9/23/10
to SimPCoRe
To reference a node you need to set a property with the value as the
node you want to reference.

Example:

$node = $sess->getRootNode();

$node1 = $node->addNode('foo');
$node2 = $node->addNode('bar');
$node2->setProperty('baz', 'test');

$node1->setProperty('ref', $node2);

//outputs 'test'
echo $node1->getProperty('ref')
->getNode()
->getProperty('baz')
->getString();

Kenneth Murphy

unread,
Sep 23, 2010, 4:40:31 PM9/23/10
to lando, SimPCoRe
wow -- the 1st post in awhile :-)

it is a way to have "structure" in your repo ... so like, if node A
references node B -- and then someone trys to delete node B, an
exception would be thrown not allowing the delete to occur because
node A references node B ...


hope that helps

Reply all
Reply to author
Forward
0 new messages