8000 Support boolean parameters in Route condition · Issue #30366 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Support boolean parameters in Route condition #30366

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

Closed
quazardous opened this issue Feb 24, 2019 · 3 comments · Fixed by #30379
Closed

Support boolean parameters in Route condition #30366

quazardous opened this issue Feb 24, 2019 · 3 comments · Fixed by #30379

Comments

@quazardous
Copy link
quazardous commented Feb 24, 2019

Description

Using parameter substitution with boolean is not allowed in route condition.

Example

So this is not possible:

/**
 * @Route("/test", condition="%kernel.debug%")
 */
class TestController extends AbstractController
{*
...

Exception is here :

// symfony/framework-bundle/Routing/Router.php
// near line 176 : hard coded type test : add is_bool() ?
...

            if (\is_string($resolved) || is_numeric($resolved)) {
                $this->collectedParameters[$match[1]] = $resolved;

                return (string) $resolved;
            }
...
@nicolas-grekas
Copy link
Member

Would you like to send a PR doing so? I'd suggest casting booleans to the "0"/"1" string.
That should target master as it's a new feature and it should come with test cases of course ;)

@quazardous
Copy link
Author

I'll give it a shot but not in the next couple of weeks. Too much on my plate 😅

@dmaicher
Copy link
Contributor

See #30379

@fabpot fabpot closed this as completed Mar 4, 2019
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this issue Mar 4, 2019
…ameters for routes (dmaicher)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[FrameworkBundle][Routing] allow boolean container parameters for routes

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #30366
| License       | MIT
| Doc PR        | symfony/symfony-docs#11059

This fixes symfony/symfony#30366 and adds support for boolean container parameters in route conditions, defaults etc.

Commits
-------

21f4e38800 [FrameworkBundle][Routing] allow boolean container parameters for routes
fabpot added a commit that referenced this issue Mar 4, 2019
…ameters for routes (dmaicher)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[FrameworkBundle][Routing] allow boolean container parameters for routes

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #30366
| License       | MIT
| Doc PR        | symfony/symfony-docs#11059

This fixes #30366 and adds support for boolean container parameters in route conditions, defaults etc.

Commits
-------

21f4e38 [FrameworkBundle][Routing] allow boolean container parameters for routes
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
0