Skip to content
This repository was archived by the owner on Oct 31, 2018. It is now read-only.

Fix: Call to undefined method OC_Helper::linkTo()#1019

Open
mmattel wants to merge 1 commit intomasterfrom
Fix_Call_to_undefined_method_OC_Helper_linkTo()
Open

Fix: Call to undefined method OC_Helper::linkTo()#1019
mmattel wants to merge 1 commit intomasterfrom
Fix_Call_to_undefined_method_OC_Helper_linkTo()

Conversation

@mmattel
Copy link
Copy Markdown

@mmattel mmattel commented Jan 22, 2016

Fixes #1018 (Error: Call to undefined method OC_Helper::linkTo() )
Needed because of: owncloud/core#21253 (Remove deprecated OC_Helper::linkTo)

@DeepDiver1975 @rullzer

@rullzer
Copy link
Copy Markdown

rullzer commented Jan 22, 2016

👍

@mmattel
Copy link
Copy Markdown
Author

mmattel commented Jan 22, 2016

@rullzer
Question:

I dropped a PHPDoc note in your merged PR removing OC_Helper::linkTo()
And got an answer: owncloud/core#21844 (comment)

  1. When I use in calendar: \OC::$server->getURLGenerator()->linkTo this works (this PR)
  2. But when I use \OCP\IURLGenerator::linkTo (for testing) this does not work. https://github.com/owncloud/core/blob/c5a200c4198de951dabdd3f783ade655b8ea6434/lib/private/urlgenerator.php#L92 I get an error:
Non-static method OCP\IURLGenerator::linkTo() cannot be called statically, assuming $this from incompatible context at /xxxx/apps/calendar/templates/calendar.php#1

a. what am I doing wrong?
b. should I stay with 1 for this PR?

@rullzer
Copy link
Copy Markdown

rullzer commented Jan 22, 2016

@mmattel it is a a way of documenting things. \OCP\IURLGenerator is just and interface. Basically we say use an object that implement \OCP\IURLGenerator and call the function linkTo on that.

Calling \OCP\IURLGenerator::linkTo is basically meanlingless since php has no clue how to get an implementation of the IURLGenerator.

So yes 1 is corerect. Because \OC::$server->getURLGenerator() gives you an instance that implement the \OCP\IURLGenerator interface. And then you call linkTo on that.

@DeepDiver1975
Copy link
Copy Markdown
Contributor

👍

@rullzer did you actually review this? 🙈

Comment thread templates/calendar.php Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you obviously need to remove the OC_Helper::linkTo ;)

@rullzer
Copy link
Copy Markdown

rullzer commented Jan 22, 2016

@rullzer did you actually review this? 🙈

Yes I did... and it worked... But I can't figure out why...

@rullzer
Copy link
Copy Markdown

rullzer commented Jan 22, 2016

ah crap... bash chokes on the () in the branch name... thus did not check out.... so I was just testing master... (on my stable core checkout)...

my bad...

@mmattel mmattel force-pushed the Fix_Call_to_undefined_method_OC_Helper_linkTo() branch from 7e06152 to 1129712 Compare January 22, 2016 15:20
@mmattel
Copy link
Copy Markdown
Author

mmattel commented Jan 25, 2016

Everything is fixed now. Pls retest

@raimund-schluessler
Copy link
Copy Markdown
Contributor

Fixes the error on 9.0 beta 1, so 👍
Could someone else check it too? @georgehrke @DeepDiver1975 ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants