Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Routing] Expose request in route conditions, if needed and possible#22636

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
ro0NL wants to merge2 commits intosymfony:2.7fromro0NL:urlmatcher-request
Closed

[Routing] Expose request in route conditions, if needed and possible#22636

ro0NL wants to merge2 commits intosymfony:2.7fromro0NL:urlmatcher-request

Conversation

ro0NL
Copy link
Contributor

@ro0NLro0NL commentedMay 4, 2017
edited
Loading

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#16968,#22635
LicenseMIT
Doc PR-

given

/** * @Route("/", name="homepage", condition="request.isXmlHttpRequest()") */
$ app/console route:match /

before

image

after

image

@javiereguiluz
Copy link
Member

I don't know if it's possible to change it, but don't you think that the error message in this case should be a yellow warning with this message?

Route "homepage" may match if condition "request.isXmlHttpRequest()" evaluates to true.

@ro0NL
Copy link
ContributorAuthor

ro0NL commentedMay 7, 2017
edited
Loading

It's possible... sure ;-) but perhaps out-of-scope for now.

The part afteralmost matches but ... comes from the traces log.. so im not really sure what i get myself into, in terms of other variants.

Alsoif (TraceableUrlMatcher::ROUTE_ALMOST_MATCHES == $trace['level']) { is quite explicit... im not sure it covers "may match" :)

{
return class_exists('Symfony\Component\HttpFoundation\Request')
? Request::create($this->context->getScheme().'://'.$this->context->getHost().$this->context->getBaseUrl().$pathinfo, $this->context->getMethod(), $this->context->getParameters())
: null;
Copy link
Member

Choose a reason for hiding this comment

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

should be on one line

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

will do 👍 i also realized the request is probably not fully functional now; it needs some server params so it can properly resolve baseurl + basepath and such. I wanted to look at that this weekend :)

@ro0NL
Copy link
ContributorAuthor

@fabpot this should do.

@@ -248,4 +248,16 @@ protected function getExpressionLanguage()

return $this->expressionLanguage;
}

protected function createRequest($pathinfo)

Choose a reason for hiding this comment

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

this should be private IMHO

Choose a reason for hiding this comment

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

hum,@internal in fact

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Done.

@nicolas-grekasnicolas-grekas added this to the2.7 milestoneMay 15, 2017
@fabpot
Copy link
Member

Thank you@ro0NL.

fabpot added a commit that referenced this pull requestJun 14, 2017
…d possible (ro0NL)This PR was squashed before being merged into the 2.7 branch (closes#22636).Discussion----------[Routing] Expose request in route conditions, if needed and possible| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#16968,#22635| License       | MIT| Doc PR        | -given```/** *@route("/", name="homepage", condition="request.isXmlHttpRequest()") */``````$ app/console route:match /```before![image](https://cloud.githubusercontent.com/assets/1047696/25716808/b9ab518e-3100-11e7-8b59-21351b5c14ca.png)after![image](https://cloud.githubusercontent.com/assets/1047696/25716833/d08065fc-3100-11e7-9462-987b2c6eaa26.png)Commits-------016e976 [Routing] Expose request in route conditions, if needed and possible
@fabpotfabpot closed thisJun 14, 2017
@fabpot
Copy link
Member

Thank you@ro0NL.

fabpot added a commit that referenced this pull requestJun 14, 2017
…d and possible (ro0NL)This PR was squashed before being merged into the 2.7 branch (closes#22636).Discussion----------[Routing] Expose request in route conditions, if needed and possible| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#16968,#22635| License       | MIT| Doc PR        | -given```/** *@route("/", name="homepage", condition="request.isXmlHttpRequest()") */``````$ app/console route:match /```before![image](https://cloud.githubusercontent.com/assets/1047696/25716808/b9ab518e-3100-11e7-8b59-21351b5c14ca.png)after![image](https://cloud.githubusercontent.com/assets/1047696/25716833/d08065fc-3100-11e7-9462-987b2c6eaa26.png)Commits-------94371d0 [Routing] Expose request in route conditions, if needed and possible
This was referencedJul 3, 2017
@ro0NLro0NL deleted the urlmatcher-request branchJuly 12, 2017 15:53
This was referencedOct 18, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@fabpotfabpotfabpot left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

Assignees
No one assigned
Projects
None yet
Milestone
2.7
Development

Successfully merging this pull request may close these issues.

5 participants
@ro0NL@javiereguiluz@fabpot@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp