-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Routing] Fixed route generation with fragment defined as defaults #20001
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
[Routing] Fixed route generation with fragment defined as defaults #20001
Conversation
b79dabb
to
9d445a0
Compare
$fragment = $defaults['_fragment']; | ||
} | ||
|
||
if (array_key_exists('_fragment', $extra)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You changed behaviour here for the case when _fragment
is null
. isset()
will return false, while array_key_exists()
will return true for a key with null
value.
9d445a0
to
40d9306
Compare
@jakzal reverted original behaviour. |
public function testFragmentsCanBeDefinedAsDefaults() | ||
{ | ||
$routes = $this->getRoutes('test', new Route('/testing', array('_fragment' => 'fragment'))); | ||
$url = $this->getGenerator($routes)->generate('test', array(), true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The third argument must not be a boolean. Please pass UrlGeneratorInterface::ABSOLUTE_PATH
here (see #20009 which fixes the other tests).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved.
40d9306
to
3c36596
Compare
👍 Status: Reviewed |
Thank you @akovalyov. |
…defaults (akovalyov) This PR was merged into the 3.2-dev branch. Discussion ---------- [Routing] Fixed route generation with fragment defined as defaults | Q | A | ------------- | --- | Branch? | "master" | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT As stated in https://symfony.com/blog/new-in-symfony-3-2-routing-improvements, it should support `_fragment` option as part of `_defaults` of route definition. Commits ------- 3c36596 [Routing] Fixed route generation with fragment defined as defaults
@fabpot my pleasure! |
As stated in https://symfony.com/blog/new-in-symfony-3-2-routing-improvements, it should support
_fragment
option as part of_defaults
of route definition.