Can't fix bug in OwnNote app for v14 beta

Hey all, until NextNote is ready, I’m trying to migrate OwnNote over to Nextcloud 14. Usually the update of the max-version in info.xml is enough, but it seems that’s not the case this time around.

My problem is here: ownnote/appinfo/app.php at master · Fmstrat/ownnote · GitHub

It seems in v9 the function was changed (https://docs.nextcloud.com/server/9/NextcloudDeveloperManual.pdf):

OCP\Util::linkToRoute has been deprecated in favour of \OCP\IURLGenerator::linkToRoute

However, if I try to use the new function:

'href' => \OCP\IURLGenerator::linkToRoute('ownnote.page.index'),

I get an error:

"Exception":"Error","Message":"Non-static method OCP\\IURLGenerator::linkToRoute() cannot be called statically"

I’ve tried other variations of the call to make this work. I’m not interested in doing a full migration as I’m also working through the mobile app for NextNote as a replacement already. I just need it to hold over until NextNote is complete.

Any ideas? Thanks!

OK, figured out I needed:

'href' => \OC::$server->getURLGenerator()->linkToRoute('ownnote.page.index'),

Now I’m getting errors about Class 'OCP\\DB' not found. Hrm…

And figured it out. For anyone having similar issues, see this commit: https://github.com/Fmstrat/ownnote/commit/f8da8821ffff36051a5aeecc9ec46a16122682bf

2 Likes