Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createAbsoluteUrl not exist in controller - getUrlManager return url not in url rules #1572

Closed
gimox opened this issue Dec 18, 2013 · 6 comments
Closed
Milestone

Comments

@gimox
Copy link
Contributor

@gimox gimox commented Dec 18, 2013

Hi
I'm tryng to obtain an bsolute url.

This work:

 \Yii::$app->controller->createUrl($url,$params);

This not exist (is correct?)

\Yii::$app->controller->createAbsoluteUrl($url,$params);

i try a different approach:
This work but not return the URl as defined in url rules

  \Yii::$app->getUrlManager()->createAbsoluteUrl($url,$params);

To obtain a corret url i do this:

\Yii::$app->getUrlManager()->getHostInfo(). \Yii::$app->controller->createUrl($url,$params);

It's a bug?

@cebe
Copy link
Member

@cebe cebe commented Dec 18, 2013

what is url in your case? When using urlmanager it can not be relative.

@qiangxue for absolute url, should we add a parameter to createUrl or add a new method?

@gimox
Copy link
Contributor Author

@gimox gimox commented Dec 18, 2013

It s a simpe url nothink strange or special. It s like update, with id

It s perfect if i call a relative by controller but it s not resolved in absolute

@qiangxue
Copy link
Member

@qiangxue qiangxue commented Dec 18, 2013

Adding createAbsoluteUrl() is better, as it is more consistent with that in UrlManager.

@gimox
Copy link
Contributor Author

@gimox gimox commented Dec 21, 2013

I think the best solution is add createAbsoluteUrls as qiangxue say.

@samdark samdark closed this in be5afe7 Dec 22, 2013
@samdark
Copy link
Member

@samdark samdark commented Dec 22, 2013

Method added. Thanks for raising the issue.

@gimox
Copy link
Contributor Author

@gimox gimox commented Dec 22, 2013

thanks for your work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.