Skip to content

[Messenger] Add documentation for RouterContextMiddleware #14969

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
Feb 16, 2021

Conversation

jderusse
Copy link
Member

fixes #14952

@OskarStark
Copy link
Contributor

Nice feature, thanks, can you add a short example on how to get this info/context in the message handler? Thanks 😃

@jderusse
Copy link
Member Author

jderusse commented Feb 13, 2021

can you add a short example on how to get this info/context in the message handler

Hmm... This is not aimed to be used by the message handler, and I don't have any use-case for this.

The purpose of this feature is to make UrlGenerator working out of the box, without providing asset.request_context parameters

$this->urlGenerator->generate('route', [], UrlGeneratorInterface::ABSOLUTE_URL);
// before: http://localhost/my_route
// after: https://my-real-domain:81/my_route

@OskarStark
Copy link
Contributor

Ah so you don't care about it directly, and just use the urGenerator which takes the provided request context into account?

@jderusse
Copy link
Member Author

jderusse commented Feb 13, 2021

Ah so you don't care about it directly, and just use the urGenerator which takes the provided request context into account?

yes, exactly. Main use case: Generating an email with link to your application, and the template is rendered by the consumer (the message contains only the template + few parameters)

@carsonbot carsonbot changed the title Add documentation for RouterContextMiddleware [Messenger] Add documentation for RouterContextMiddleware Feb 16, 2021
@javiereguiluz javiereguiluz merged commit 7aad004 into symfony:5.x Feb 16, 2021
@javiereguiluz
Copy link
Member

Jérémy thanks a lot for providing these docs. While merging we did some rewording in the explanation, but we left the essence of your contribution intact. Thanks!

@xabbuh xabbuh added this to the 5.3 milestone Feb 17, 2021
wouterj added a commit that referenced this pull request Jan 16, 2022
This PR was submitted for the 5.4 branch but it was squashed and merged into the 4.4 branch instead.

Discussion
----------

[Messenger] Document the validation middleware

Close #10474

I took inspiration on the doc https://symfonycasts.com/screencast/messenger/other-middleware#validation-doctrine-transaction-etc-middleware

Reference this doc #14969 so I added next to it

Commits
-------

0fc886d [Messenger] Document the validation middleware
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.

[FrameworkBundle][Messenger] Added RouterContextMiddleware
5 participants