Skip to content

Commit

Permalink
code documentation about bug fix #17
Browse files Browse the repository at this point in the history
  • Loading branch information
adou600 committed Apr 28, 2012
1 parent 9c10890 commit 4597083
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion src/Jackalope/Transport/DoctrineDBAL/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ public function copyNode($srcAbsPath, $dstAbsPath, $srcWorkspace = null)
$dom->loadXML($row['props']);

$propsData = array('dom' => $dom, 'binaryData' => array());
//when copying a node, it is always a new node, then $isNewNode is set to true
$newNodeId = $this->syncNode(null, $newPath, $this->getParentPath($newPath), $row['type'], true, array(), $propsData);

$query = 'INSERT INTO phpcr_binarydata (node_id, property_name, workspace_id, idx, data)'.
Expand Down Expand Up @@ -449,6 +450,26 @@ private function getJcrName($path)
return array($namespaces[$alias], $name);
}


/**
* @param $uuid string node uuid
*
* @param $path string absolute path of the node
*
* @param $parent string absolute path of the parent node
*
* @param $type string node type
*
* @param $isNewNode bool new nodes to insert (true) or existing node to update (false)
*
* @param array $props
*
* @param array $propsData
*
* @return bool|mixed|string
*
* @throws \Exception|\PHPCR\ItemExistsException|\PHPCR\RepositoryException
*/
private function syncNode($uuid, $path, $parent, $type, $isNewNode, $props = array(), $propsData = array())
{
// TODO: Not sure if there are always ALL props in $props, should we grab the online data here?
Expand Down Expand Up @@ -1154,7 +1175,18 @@ private function getResponsibleNodeTypes(Node $node)
}

/**
* {@inheritDoc}
* Recursively store a node and its children to the given absolute path.
*
* Transport stores the node at its path, with all properties and all
* children.
*
* @param \Jackalope\Node $node the node to store
*
* @param bool $saveChildren bool false to store only the current node and not its children
*
* @return bool bool true on success
*
* @throws \PHPCR\RepositoryException if not logged in
*/
public function storeNode(Node $node, $saveChildren = true)
{
Expand Down Expand Up @@ -1201,6 +1233,7 @@ public function storeProperty(Property $property)
$this->assertLoggedIn();

$node = $property->getParent();
//do not store the children nodes, already taken into account previously with storeNode
$this->storeNode($node, false);

return true;
Expand Down

0 comments on commit 4597083

Please sign in to comment.