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

[FrameworkBundle] keep query in redirect#26281

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

Merged

Conversation

@Simperfit
Copy link
Contributor

@SimperfitSimperfit commentedFeb 23, 2018
edited by javiereguiluz
Loading

QA
Branch?4.1
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#26256
LicenseMIT
Doc PRsymfony/symfony-docs#9314

@SimperfitSimperfitforce-pushed thefeature/keep-query-in-redirect branch fromc8c18f2 toa400739CompareFebruary 23, 2018 09:47
@SimperfitSimperfit changed the titleFeature/keep query in redirect[FrameworkBundle] feature: keep query in redirectFeb 23, 2018
@SimperfitSimperfitforce-pushed thefeature/keep-query-in-redirect branch 3 times, most recently from5fe9639 to5f3b11eCompareFebruary 23, 2018 09:55
@nicolas-grekasnicolas-grekas added this to the4.1 milestoneFeb 23, 2018
* @param string $route The route name to redirect to
* @param bool $permanent Whether the redirection is permanent
* @param bool|array $ignoreAttributes Whether to ignore attributes or an array of attributes to ignore
* @param bool $keepRequestMethod Wheter redirect action should keep HTTP request method
Copy link
Member

Choose a reason for hiding this comment

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

Should probably be fixed on 2.7 instead, see#25859 in progress

$controller =newRedirectController($router);

$returnResponse =$controller->redirectAction($request,$route,$permanent,$ignoreAttributes,$keepRequestMethod);

Copy link
Member

Choose a reason for hiding this comment

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

to revert

@SimperfitSimperfitforce-pushed thefeature/keep-query-in-redirect branch from5f3b11e tob6a2af3CompareFebruary 23, 2018 13:47
@Simperfit
Copy link
ContributorAuthor

This PR is rdy.

@nicolas-grekasnicolas-grekas changed the title[FrameworkBundle] feature: keep query in redirect[FrameworkBundle] keep query in redirectMar 19, 2018
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

with minor comments

$attributes =array();
if (false ===$ignoreAttributes ||is_array($ignoreAttributes)) {
$attributes =$request->attributes->get('_route_params');
$routeParams =$request->attributes->get('_route_params');

Choose a reason for hiding this comment

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

I'd suggest keeping the name $attributes, it's still valid and will reduce merge conflicts
on the next line, no need for the\ in front of array_merge

if (false ===$ignoreAttributes ||is_array($ignoreAttributes)) {
$attributes =$request->attributes->get('_route_params');
$routeParams =$request->attributes->get('_route_params');
$attributes =$keepQueryParams ?\array_merge($request->query->all(),$routeParams) :$routeParams;
Copy link
Member

Choose a reason for hiding this comment

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

I suggest adding a test ensuring that attributes coming from_route_params still win over attributes coming from the query string when merging them together.

$request->query =newParameterBag(array('base' =>'zaza'));
$request->attributes =newParameterBag(array('_route_params' =>array()));
$urlGenerator =$this->getMockBuilder(UrlGeneratorInterface::class)->getMock();
$urlGenerator->expects($this->any())->method('generate')->will($this->returnValue('/test?base=zaza'));
Copy link
Member

Choose a reason for hiding this comment

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

this does not test anything, as you don't assert arguments received by the router. Try to run your test on the unpatched codebase of the controller, and you will see that it will pass too.

@Simperfit
Copy link
ContributorAuthor

@stof done.

@SimperfitSimperfitforce-pushed thefeature/keep-query-in-redirect branch fromb6a2af3 to406bfc9CompareMarch 26, 2018 14:59
@Simperfit
Copy link
ContributorAuthor

Status: Needs Review

@fabpot
Copy link
Member

Thank you@Simperfit.

@fabpotfabpot merged commit406bfc9 intosymfony:masterMar 27, 2018
fabpot added a commit that referenced this pull requestMar 27, 2018
This PR was merged into the 4.1-dev branch.Discussion----------[FrameworkBundle] keep query in redirect| Q             | A| ------------- | ---| Branch?       | 4.1| Bug fix?      | no| New feature?  | yes <!-- don't forget to update src/**/CHANGELOG.md files -->| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets |#26256   <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        |#9314<!--Write a short README entry for your feature/bugfix here (replace this comment block.)This will help people understand your PR and can be used as a start of the Doc PR.Additionally: - Bug fixes must be submitted against the lowest branch where they apply   (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the master branch.-->Commits-------406bfc9 [FrameworkBundle] keep query params in redirection
@SimperfitSimperfit deleted the feature/keep-query-in-redirect branchMarch 27, 2018 07:48
@fabpotfabpot mentioned this pull requestMay 7, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@chalasrchalasrchalasr left review comments

@stofstofstof requested changes

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.1

Development

Successfully merging this pull request may close these issues.

6 participants

@Simperfit@fabpot@nicolas-grekas@stof@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp