Skip to content
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

Documented the ArgumentResolver along the ControllerResolver #6422

Closed
wants to merge 1 commit into from

Conversation

linaori
Copy link
Contributor

@linaori linaori commented Apr 1, 2016

Q A
Doc fix? yes
New docs? no ~ symfony/symfony#18308
Applies to 3.1
Fixed tickets ~

The ArgumentResolver is used now instead of the ControllerResolver. I have yet to document the extension point but first I want to have this page mention it.

@linaori linaori force-pushed the feature/argument-resolvers branch 3 times, most recently from 00e0e7b to 678c705 Compare April 1, 2016 11:56
@linaori linaori changed the title Documented the ArgumentResolver along the ControllerResolver [WiP] Documented the ArgumentResolver along the ControllerResolver Apr 1, 2016
@linaori linaori force-pushed the feature/argument-resolvers branch 2 times, most recently from bd2fb26 to 947626c Compare April 1, 2016 13:47
@javiereguiluz
Copy link
Member

@iltar thanks for this contribution. We'll need to change a bit the "tone" (some parts read too informal) but so far contents are very promising. Thanks!

@linaori
Copy link
Contributor Author

linaori commented Apr 1, 2016

@javiereguiluz sure thing! I'm not too experienced with the language style so I'm firstly making sure the contents is up-to-date so it can be fine-tuned afterwards. This is always the hardest part for me writing documentation.

When writing code, you have codestyle, but when you're writing texts it's almost freestyle ;)

@javiereguiluz
Copy link
Member

@iltar you are doing great! It's just a matter of minor "cosmetic changes". But for now don't worry about them 😄

@linaori
Copy link
Contributor Author

linaori commented Apr 1, 2016

@javiereguiluz is the array shorthand notation preferred or do you want the full notation?

edit - for now I will keep amending so I can see if I make parse errors without too many issues, phpstorm only shows me highlights, no validation

@javiereguiluz
Copy link
Member

@iltar we still use array() in the docs.

@linaori linaori force-pushed the feature/argument-resolvers branch 2 times, most recently from 25f4985 to 2eecbd2 Compare April 1, 2016 14:21
@linaori linaori force-pushed the feature/argument-resolvers branch 2 times, most recently from 66ee94b to 1ce0cc7 Compare April 2, 2016 16:28

.. caution::

The `getArguments()` method in the :class:`Symfony\\Component\\Httpkernel\\Controller\\ControllerResolver`
Copy link
Member

Choose a reason for hiding this comment

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

getArguments must be surrounded by two `

fabpot added a commit to symfony/symfony that referenced this pull request Apr 3, 2016
…iltar, HeahDude)

This PR was merged into the 3.1-dev branch.

Discussion
----------

Added an ArgumentResolver with clean extension point

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #17933 (pre-work), #1547, #10710
| License       | MIT
| Doc PR        | symfony/symfony-docs#6422

**This PR is a follow up for and blocked by: #18187**, relates to #11457 by @wouterj. When reviewing, please take the last commit: [Added an ArgumentResolver with clean extension point](4c092b3)

This PR provides:
- The ability to tag your own `ArgumentValueResolverInterface`. This means that you can effectively expand on the argument resolving in the `HttpKernel` without having to implement your own `ArgumentResolver`.

- The possibility to cache away argument metadata via a new `ArgumentMetadataFactory` which simply fetches the data from the cache, effectively omitting 1 reflection call per request. *Not implemented in this PR, but possible once this is merged.*

- The possibility to add a PSR-7 adapter to resolve the correct request, avoids the paramconverters
- The possibility to add a value resolver to fetch stuff from $request->query
- Drupal could simplify [their argument resolving](https://github.com/drupal/drupal/blob/8.1.x/core/lib/Drupal/Core/Controller/ControllerResolver.php) by a lot
- etc.

The aim for this PR is to provide a 100% BC variant to add argument resolving in a clean way, this is shown by the 2 tests: `LegacyArgumentResolverTest` and `ArgumentResolverTest`.

/cc @dawehner @larowlan if you have time, can you check the impact for Drupal? I think this should be a very simple change which should make it more maintainable.

Commits
-------

1bf80c9 Improved DX for the ArgumentResolver
f29bf4c Refactor ArgumentResolverTest
cee5106 cs fixes
cfcf764 Added an ArgumentResolver with clean extension point
360fc5f Extracting arg resolving from ControllerResolver
@linaori
Copy link
Contributor Author

linaori commented Apr 6, 2016

So the PR is merged and the previous comments are addressed. I will open a new PR once I'm done writing some initial docs about the actual feature.

I think everything code related is fixed in this PR so it's up to the text itself now

@xabbuh
Copy link
Member

xabbuh commented Apr 6, 2016

@iltar Is this supposed to be merged before #6438 or the other way around?

@linaori
Copy link
Contributor Author

linaori commented Apr 6, 2016

@xabbuh it doesn't really matter, one describes the feature, the other makes sure the documentation doesn't trigger deprecations in your code.

@@ -85,11 +85,22 @@ is really simple and involves creating an
:doc:`event dispatcher </components/event_dispatcher/introduction>` and a
:ref:`controller resolver <component-http-kernel-resolve-controller>` (explained
below). To complete your working kernel, you'll add more event listeners
to the events discussed below::
to the events discussed below
Copy link
Contributor

Choose a reason for hiding this comment

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

missing colon ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved the caution to below, this also fixes the issue where the : refers to a caution instead of the intended code.

Copy link
Member

Choose a reason for hiding this comment

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

Then it should be a full stop (.).

@linaori linaori force-pushed the feature/argument-resolvers branch from 24b11e2 to a9897c7 Compare April 14, 2016 11:30
fabpot added a commit to symfony/symfony that referenced this pull request Apr 15, 2016
This PR was merged into the 3.1-dev branch.

Discussion
----------

[HttpKernel] Renamed the argument resolver tag

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | not if merged before 3.1
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~
| License       | MIT
| Doc PR        | ~

Changed as discussed several times: #18510 (comment), symfony/symfony-docs#6422 (comment).

Commits
-------

cd10057 Renamed argument resolver tag, added test
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull request Apr 15, 2016
This PR was merged into the 3.1-dev branch.

Discussion
----------

[HttpKernel] Renamed the argument resolver tag

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | not if merged before 3.1
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~
| License       | MIT
| Doc PR        | ~

Changed as discussed several times: symfony/symfony#18510 (comment), symfony/symfony-docs#6422 (comment).

Commits
-------

cd10057 Renamed argument resolver tag, added test
@linaori
Copy link
Contributor Author

linaori commented Apr 15, 2016

Broken build is related to:

:doc:`/cookbook/controller/argument_value_resolver`

This will be solved as soon as #6438 is merged.

@xabbuh xabbuh added the On hold label Apr 15, 2016
@wouterj wouterj removed the On hold label Jun 11, 2016
@wouterj
Copy link
Member

wouterj commented Jun 11, 2016

Merged #6438 now. Can you please rebase?

@linaori linaori force-pushed the feature/argument-resolvers branch from a9897c7 to 4edfe5a Compare June 12, 2016 09:13
@linaori
Copy link
Contributor Author

linaori commented Jun 12, 2016

@wouterj rebase is done and checks pass now

:class:`Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface` and
use any argument resolver that implements the
:class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolverInterface`.
However, the HttpKernel component comes with some built-in listeners, and everything
Copy link
Member

Choose a reason for hiding this comment

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

remove the comma before and

@wouterj
Copy link
Member

wouterj commented Jun 12, 2016

Can you please also fix the outstanding comments (both from me and others)? Sorry for not reviewing it before asking you to rebase.

@xabbuh
Copy link
Member

xabbuh commented Jul 4, 2016

@iltar Is this still a work in progress from your point of view?

@linaori
Copy link
Contributor Author

linaori commented Jul 4, 2016

@xabbuh I totally forgot to fix the title! No, this should be finished.

@linaori linaori changed the title [WiP] Documented the ArgumentResolver along the ControllerResolver Documented the ArgumentResolver along the ControllerResolver Jul 4, 2016
$response = $framework->handle($request);

$response->send();


Copy link
Member

Choose a reason for hiding this comment

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

should be removed

@xabbuh
Copy link
Member

xabbuh commented Jul 4, 2016

👍

@linaori linaori force-pushed the feature/argument-resolvers branch from a26f622 to 3eda91d Compare July 4, 2016 12:06
@linaori linaori force-pushed the feature/argument-resolvers branch from 3eda91d to f630d8d Compare July 4, 2016 12:08
@linaori
Copy link
Contributor Author

linaori commented Jul 4, 2016

Fixed a merge conflict and the feedback, can you please check it 1 time if everything went fine? I had a small issue inbetween

@xabbuh
Copy link
Member

xabbuh commented Jul 5, 2016

👍 still looks good to me

Status: Reviewed

Note to merger: This needs to be merged in the 3.1 branch.

wouterj added a commit that referenced this pull request Jul 5, 2016
…olver (iltar)

This PR was submitted for the master branch but it was merged into the 3.1 branch instead (closes #6422).

Discussion
----------

Documented the ArgumentResolver along the ControllerResolver

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no ~ symfony/symfony#18308
| Applies to    | 3.1
| Fixed tickets | ~

The ArgumentResolver is used now instead of the ControllerResolver. I have yet to document the extension point but first I want to have this page mention it.

Commits
-------

11920e3 Documented the ArgumentResolver along the ControllerResolver
@wouterj
Copy link
Member

wouterj commented Jul 5, 2016

Thanks @iltar! This is a big PR :)

I've merged this into the 3.1 branch as usual. After merging, I reread all changed sections and did some minor changes in 998cc40 It would be great if you can review them.

@wouterj wouterj closed this Jul 5, 2016
@linaori
Copy link
Contributor Author

linaori commented Jul 5, 2016

@wouterj I've checked it, LGTM

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.

8 participants