Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 38b4d06

Browse files
committed
remove invalid basename calls
1 parent 1b6cc87 commit 38b4d06

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Tree/PHPCRTree.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
use Doctrine\Bundle\PHPCRBundle\ManagerRegistry;
66

7-
use PHPCR\Util\NodeHelper;
87
use PHPCR\PropertyType;
8+
use PHPCR\Util\NodeHelper;
9+
use PHPCR\Util\PathHelper;
910

1011
/**
1112
* A simple class to get PHPCR trees in JSON format
@@ -89,10 +90,10 @@ public function getProperties($path)
8990
// TODO: this should be part of the interface. and the target should include the name to allow renames
9091
public function move($moved_path, $target_path)
9192
{
92-
$resulting_path = $target_path.'/'.basename($moved_path);
93+
$resulting_path = $target_path.'/'.PathHelper::getNodeName($moved_path);
9394

9495
$workspace = $this->session->getWorkspace();
95-
$workspace->move($moved_path, $target_path.'/'.basename($moved_path));
96+
$workspace->move($moved_path, $target_path.'/'.PathHelper::getNodeName($moved_path));
9697

9798
return array('id' => $resulting_path, 'url_safe_id' => ltrim($resulting_path, '/'));
9899
}
@@ -109,7 +110,7 @@ public function move($moved_path, $target_path)
109110
public function reorder($parent, $moved, $target, $before)
110111
{
111112
$parentNode = $this->session->getNode($parent);
112-
$targetName = basename($target);
113+
$targetName = PathHelper::getNodeName($target);
113114
if (!$before) {
114115
$nodesIterator = $parentNode->getNodes();
115116
$nodesIterator->rewind();
@@ -127,7 +128,7 @@ public function reorder($parent, $moved, $target, $before)
127128
}
128129
}
129130
}
130-
$parentNode->orderBefore(basename($moved), $targetName);
131+
$parentNode->orderBefore(PathHelper::getNodeName($moved), $targetName);
131132
$this->session->save();
132133
}
133134

0 commit comments

Comments
 (0)