Skip to content

[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

Merged
merged 1 commit into from
Sep 21, 2016

Conversation

akovalyov
Copy link
Contributor

@akovalyov akovalyov commented Sep 21, 2016

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.

$fragment = $defaults['_fragment'];
}

if (array_key_exists('_fragment', $extra)) {
Copy link
Contributor

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.

@akovalyov akovalyov force-pushed the bugfix/router-fragment-as-defaults branch from 9d445a0 to 40d9306 Compare September 21, 2016 10:24
@akovalyov
Copy link
Contributor Author

@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);
Copy link
Member

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).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved.

@akovalyov akovalyov force-pushed the bugfix/router-fragment-as-defaults branch from 40d9306 to 3c36596 Compare September 21, 2016 14:49
@xabbuh
Copy link
Member

xabbuh commented Sep 21, 2016

👍

Status: Reviewed

@fabpot
Copy link
Member

fabpot commented Sep 21, 2016

Thank you @akovalyov.

@fabpot fabpot merged commit 3c36596 into symfony:master Sep 21, 2016
fabpot added a commit that referenced this pull request Sep 21, 2016
…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
@akovalyov akovalyov deleted the bugfix/router-fragment-as-defaults branch September 21, 2016 20:19
@akovalyov
Copy link
Contributor Author

@fabpot my pleasure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants