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

[RFC] Allow several stamps of the same kind on an Envelope #29156

Closed
nicolas-grekas opened this Issue Nov 9, 2018 · 0 comments

Comments

Projects
None yet
3 participants
@nicolas-grekas
Member

nicolas-grekas commented Nov 9, 2018

$envelope->with(new SomeStamp()) could add to a collection of SomeStamp stamps.
Same as HTTP allows the same header to be found several times with valid use cases.
Right now, we replace any previous value without notice. I feel like it's going to hit us sooner or later.

@nicolas-grekas nicolas-grekas added the RFC label Nov 9, 2018

@xabbuh xabbuh added the Messenger label Nov 9, 2018

@fabpot fabpot closed this Nov 12, 2018

fabpot added a commit that referenced this issue Nov 12, 2018

feature #29159 [Messenger] collect all stamps added on Envelope as co…
…llections (nicolas-grekas)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[Messenger] collect all stamps added on Envelope as collections

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #29156
| License       | MIT
| Doc PR        | -

Late small BC break for Messenger:
 * `Envelope::all()` takes a new optional `$stampFqcn` argument and returns the stamps for the specified FQCN, or all stamps by their class name
 * `Envelope::get()` has been renamed `Envelope::last()`

This fixes the current behavior where we replace any previous stamp with the same type, which is unexpected to me as it silently loses data and more importantly blocks interesting use cases we're going to need in the near future.
Basically, that's the same as HTTP headers being allowed to exist several times: most of them make no sense as collections, but some are really useful as collections.

Commits
-------

2e98859 [Messenger] collect all stamps added on Envelope as collections
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment