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

Comments

Projects
None yet
4 participants
@gimox
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@cebe

cebe Dec 18, 2013

Member

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?

Member

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

This comment has been minimized.

Show comment
Hide comment
@gimox

gimox Dec 18, 2013

Contributor

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

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@qiangxue

qiangxue Dec 18, 2013

Member

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

Member

qiangxue commented Dec 18, 2013

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

@gimox

This comment has been minimized.

Show comment
Hide comment
@gimox

gimox Dec 21, 2013

Contributor

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

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@samdark

samdark Dec 22, 2013

Member

Method added. Thanks for raising the issue.

Member

samdark commented Dec 22, 2013

Method added. Thanks for raising the issue.

@gimox

This comment has been minimized.

Show comment
Hide comment
@gimox

gimox Dec 22, 2013

Contributor

thanks for your work

Contributor

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