GitHub PullRequestReviewCommentEvent at 2014-01-16 10:43:52
Repository: createphp
Actor: dbu
Payload: {"comment":{"url":"https://api.github.com/repos/flack/createphp/pulls/comments/8927570","id":8927570,"diff_hunk":"@@ -159,4 +164,77 @@ private function determineEntityTitle(EntityInterface $entity)\n             throw new RuntimeException('No title could be found four your new node.');\n         }\n     }\n+\n+    /**\n+     * Reorder the children of the collection node according to the expected order\n+     *\n+     * @param EntityInterface $entity\n+     * @param CollectionInterface $node\n+     * @param $expectedOrder array of subjects\n+     */\n+    public function orderChildren(EntityInterface $entity, CollectionInterface $node, $expectedOrder)\n+    {\n+        array_walk($expectedOrder, array($this, 'getNodeName'));\n+        $childrenCollection = $this->getChildren($entity->getObject(), $node);\n+        $children = $childrenCollection->toArray();\n+        $childrenNames = array_keys($children);\n+\n+        $childrenNames = $this->sort($childrenNames, $expectedOrder);\n+\n+        $childrenCollection->clear();\n+\n+        foreach ($childrenNames as $name) {\n+            $childrenCollection->set($name, $children[$name]);\n+        }\n+    }\n+\n+    /**\n+     * Get the node name\n+     *\n+     * @param $item\n+     * @param $key\n+     */\n+    public function getNodeName(&$item, $key)\n+    {\n+        $item = PathHelper::getNodeName($item);\n+    }\n+\n+    /**\n+     * stable sort is not implemented in php, so we need to sort ourself\n+     */\n+    public function sort($array, $reference)","path":"src/Midgard/CreatePHP/Mapper/DoctrinePhpcrOdmMapper.php","position":73,"original_position":73,"commit_id":"6b12588c16dc90d2d0e1f53bb9129890347dcb05","original_commit_id":"6b12588c16dc90d2d0e1f53bb9129890347dcb05","user":{"login":"dbu","id":76576,"avatar_url":"https://gravatar.com/avatar/c9f4f8ce2c2936bacaf49500b5a127dc?d=https%3A%2F%2Fidenticons.github.com%2F8b3432e34d73182c191e65586b395c06.png&r=x","gravatar_id":"c9f4f8ce2c2936bacaf49500b5a127dc","url":"https://api.github.com/users/dbu","html_url":"https://github.com/dbu","followers_url":"https://api.github.com/users/dbu/followers","following_url":"https://api.github.com/users/dbu/following{/other_user}","gists_url":"https://api.github.com/users/dbu/gists{/gist_id}","starred_url":"https://api.github.com/users/dbu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbu/subscriptions","organizations_url":"https://api.github.com/users/dbu/orgs","repos_url":"https://api.github.com/users/dbu/repos","events_url":"https://api.github.com/users/dbu/events{/privacy}","received_events_url":"https://api.github.com/users/dbu/received_events","type":"User","site_admin":false},"body":"ah, i see. maybe you could add an explicit comment somewhere in the code about that the response might not contain all children?\r\n\r\nbtw, what happens with children that are not mentioned? append at the end?","created_at":"2014-01-16T10:43:52Z","updated_at":"2014-01-16T10:43:52Z","html_url":"https://github.com/flack/createphp/pull/62#discussion_r8927570","pull_request_url":"https://api.github.com/repos/flack/createphp/pulls/62","_links":{"self":{"href":"https://api.github.com/repos/flack/createphp/pulls/comments/8927570"},"html":{"href":"https://github.com/flack/createphp/pull/62#discussion_r8927570"},"pull_request":{"href":"https://api.github.com/repos/flack/createphp/pulls/62"}}}}