private function handle_copy($route_id, &$data) { $destination = $this->check_destination($data['dest']); if (!$this->get_snippetdir($this->object_path)) { // Possibly copying snippets instead if (!$this->get_snippet($this->object_path)) { throw new midgardmvc_exception_notfound("Snippetdir {$this->object_path} not found"); } $new_snippet = new midgard_snippet(); $new_snippet->up = $destination['snippetdir']->id; $new_snippet->name = str_replace('.php', '', $destination['name']); $new_snippet->code = $this->snippet->code; $new_snippet->create(); return; } $new_snippetdir = new midgard_snippetdir(); $new_snippetdir->up = $destination['snippetdir']->id; $new_snippetdir->name = $destination['name']; $new_snippetdir->create(); }