4
4
5
5
use Doctrine \Bundle \PHPCRBundle \ManagerRegistry ;
6
6
7
- use PHPCR \Util \NodeHelper ;
8
7
use PHPCR \PropertyType ;
8
+ use PHPCR \Util \NodeHelper ;
9
+ use PHPCR \Util \PathHelper ;
9
10
10
11
/**
11
12
* A simple class to get PHPCR trees in JSON format
@@ -89,10 +90,10 @@ public function getProperties($path)
89
90
// TODO: this should be part of the interface. and the target should include the name to allow renames
90
91
public function move ($ moved_path , $ target_path )
91
92
{
92
- $ resulting_path = $ target_path .'/ ' .basename ($ moved_path );
93
+ $ resulting_path = $ target_path .'/ ' .PathHelper:: getNodeName ($ moved_path );
93
94
94
95
$ 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 ));
96
97
97
98
return array ('id ' => $ resulting_path , 'url_safe_id ' => ltrim ($ resulting_path , '/ ' ));
98
99
}
@@ -109,7 +110,7 @@ public function move($moved_path, $target_path)
109
110
public function reorder ($ parent , $ moved , $ target , $ before )
110
111
{
111
112
$ parentNode = $ this ->session ->getNode ($ parent );
112
- $ targetName = basename ($ target );
113
+ $ targetName = PathHelper:: getNodeName ($ target );
113
114
if (!$ before ) {
114
115
$ nodesIterator = $ parentNode ->getNodes ();
115
116
$ nodesIterator ->rewind ();
@@ -127,7 +128,7 @@ public function reorder($parent, $moved, $target, $before)
127
128
}
128
129
}
129
130
}
130
- $ parentNode ->orderBefore (basename ($ moved ), $ targetName );
131
+ $ parentNode ->orderBefore (PathHelper:: getNodeName ($ moved ), $ targetName );
131
132
$ this ->session ->save ();
132
133
}
133
134
0 commit comments