Skip to content

Add missing Symfony Routing options to operations configuration #1472

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 2 commits into from
Nov 8, 2017
Merged

Add missing Symfony Routing options to operations configuration #1472

merged 2 commits into from
Nov 8, 2017

Conversation

philippecarle
Copy link
Contributor

@philippecarle philippecarle commented Nov 1, 2017

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets N/A
License MIT
Doc PR #330

I was trying to associate a default key/value association to a given route following this Symfony documentation when I realized there is actually no way to do this as the defaults configuration of a Symfony route is not available in operations. This PR tries to fix this.
I don't know much about the new subresources feature yet and couldn't really guess if it was relevant to also cover these routes.
Please let me know if this PR sounds fine to you and if I should pay attention to the subresources topic.

@dunglas
Copy link
Member

dunglas commented Nov 2, 2017

It would be nice to do it for all constructor arguments of the Route class.

@philippecarle
Copy link
Contributor Author

@dunglas It sounds right. I'll update the PR asap, most probably not tonight but tomorrow.
Just so that we can be at the same page: I should also merge / add options, schemes, and host, isn't it ?

@philippecarle
Copy link
Contributor Author

philippecarle commented Nov 2, 2017

OK I lied 🤥
Couldn't wait until tomorrow, it was too easy to be postponed 😄

@philippecarle philippecarle changed the title Merge defaults set in operations definitions with the internal ones Add missing Symfony Routing options to operations configuration Nov 2, 2017
@soyuka
Copy link
Member

soyuka commented Nov 6, 2017

This could be a fix on 2.1 wdyt?

@philippecarle philippecarle changed the base branch from master to 2.1 November 6, 2017 14:31
@philippecarle
Copy link
Contributor Author

Base branch updated on 2.1

[],
$operation['options'] ?? [],
$operation['host'] ?? '',
$operation['schemes'] ?? [],
[$operation['method']]
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Missed it 🙄 , fixed by last commit

Copy link
Member

@dunglas dunglas left a comment

Choose a reason for hiding this comment

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

The code looks good to me.

@dunglas
Copy link
Member

dunglas commented Nov 7, 2017

Just a question (and I've no strong opinion about that): should we add all these new options to the root operation array (it may be confusing, for instance "condition"), or should be put them under a "routing" key? ping @api-platform/core-team

@philippecarle
Copy link
Contributor Author

In my user opinion, it would be quite confusing too to have them under a routing key and it would be quite unaesthetic too to have another nested optional key/value pair holding routing options while some are at the top level of the operation (path, method & requirements). Just sayin' 😀

@dunglas
Copy link
Member

dunglas commented Nov 8, 2017

Ok then LGTM.

@dunglas dunglas merged commit 14300d0 into api-platform:2.1 Nov 8, 2017
@dunglas
Copy link
Member

dunglas commented Nov 8, 2017

Thank you @philippecarle! Would you mind opening a doc PR please?

@antograssiot
Copy link
Contributor

api-platform/docs#330 is already there @dunglas

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