This PR was merged into the 4.2-dev branch.
Discussion
----------
[DI][DX] Allow exclude to be an array of patterns
| Q | A
| ------------- | ---
| Branch? | 4.2
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #23956
| License | MIT
This is basically continuing #24428.
In YAML before:
```yaml
AppBundle\:
resource: '../../src/AppBundle/*'
exclude: '../../src/AppBundle/{Entity,Payload,Repository}'
```
in YAML after:
```yaml
AppBundle\:
resource: '../../src/AppBundle/*'
exclude:
- '../../src/AppBundle/{Entity,Payload,Repository}'
- '../../src/AppBundle/Event/*Event.php'
```
In XML before:
```xml
<prototype namespace="App\" resource="../src/*" exclude="../src/{Entity,Migrations,Tests}" />
```
in XML after:
```xml
<prototype namespace="App\" resource="../src/*">
<exclude>../src/{Entity,Migrations,Tests}</exclude>
<exclude>../src/Yolo</exclude>
</prototype>
```
In PHP before:
```php
$di->load(Prototype::class.'\\', '../Prototype')
->autoconfigure()
->exclude('../Prototype/{OtherDir,BadClasses}')
```
In PHP after:
```php
$di->load(Prototype::class.'\\', '../Prototype')
->autoconfigure()
->exclude(['../Prototype/OtherDir', '../Prototype/BadClasses'])
```
Everything is backward compatible.
Maybe a decision about handling both attribute exclude and element exclude in XML should be taken.
Commits
-------
3ae3a03f41 [DI][DX] Allow exclude to be an array of patterns (taking #24428 over)
This PR was squashed before being merged into the 4.1 branch (closes#27209).
Discussion
----------
[Workflow] add is deprecated since Symfony 4.1. Use addWorkflow() instead
| Q | A
| ------------- | ---
| Branch? | 4.1
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #...
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Commits
-------
ffa5d1ca94 [Workflow] add is deprecated since Symfony 4.1. Use addWorkflow() instead
* 4.1:
[Messenger][DX] Uses a default receiver when only one is defined
fix deps
[Profiler] Join using ';\n'
Rename the command `DebugCommand`
[Messenger] Add debug:messenger CLI command
[Messenger] Fix default bus name
Fix the transport factory after moving it
[Messenger] Fix AMQP Transport factory & TransportFactoryInterface
Fix AmqpTransport
[Profiler] Fix dump makes toolbar disappear
Improved exception on invalid message type
bumped Symfony version to 4.1.0
updated VERSION for 4.1.0-BETA1
updated CHANGELOG for 4.1.0-BETA1
[Messenger] Add TransportInterface as first class citizen sender+receiver
This PR was squashed before being merged into the 4.1 branch (closes#27203).
Discussion
----------
[Messenger][DX] Uses a default receiver when only one is defined
| Q | A
| ------------- | ---
| Branch? | 4.1
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ø
| License | MIT
| Doc PR | ø
When using only one receiver, as a developer, it makes no sense for me to have to precise the receiver name when using the `messenger:consume-messages` command. This is the change:
```patch
- bin/console messenger:consume-messages default
+ bin/console messenger:consume-messages
```
If I have more than one transport configured, I'll get the following message:
>
> You have 0 or more than one receiver (no default have been found). You need to specify the receiver name with an argument.
>
Commits
-------
8315b868d5 [Messenger][DX] Uses a default receiver when only one is defined
This PR was merged into the 4.1 branch.
Discussion
----------
[Messenger] Add debug:messenger CLI command
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Adds a `debug:messenger` CLI command to expose message classes that can be dispatched. Heavily inspired by `debug:autowiring`.
Commits
-------
7f87309c10 fix deps
290c7eb1bc Rename the command `DebugCommand`
9847b83723 [Messenger] Add debug:messenger CLI command
This PR was merged into the 4.1 branch.
Discussion
----------
[Profiler] Fix dump makes toolbar disappear
| Q | A
| ------------- | ---
| Branch? | 4.1 <!-- see below -->
| Bug fix? | yes
| New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #27180 <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | N/A
Don't know if there is a better solution than executing eval on the global scope.
For ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval
> If you use the eval function indirectly, by invoking it via a reference other than eval, as of ECMAScript 5 it works in the global scope rather than the local scope. This means, for instance, that function declarations create global functions, and that the code being evaluated doesn't have access to local variables within the scope where it's being called.
Commits
-------
0cd51ae267 [Profiler] Fix dump makes toolbar disappear
This PR was merged into the 4.1 branch.
Discussion
----------
[Messenger] Fix default bus name
| Q | A
| ------------- | ---
| Branch? | 4.1 <!-- see below -->
| Bug fix? | yesish
| New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #27162 <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | N/A
After #27162, the default bus name configured automatically should use a full service id too, otherwise we currently get a `default` service id, no namespace identifier, which is the default bus.
Commits
-------
fa9b9849b1 [Messenger] Fix default bus name
This PR was merged into the 4.1 branch.
Discussion
----------
[Messenger] Fix the transport factory after moving it
| Q | A
| ------------- | ---
| Branch? | 4.1
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #27164
| License | MIT
| Doc PR | ø
`ChainTransportFactory` was renamed but the `messenger.xml` wasn't changed.
Commits
-------
7a091d9d61 Fix the transport factory after moving it
This PR was merged into the 4.1 branch.
Discussion
----------
[Messenger] Fix AMQP Transport factory & TransportFactoryInterface
| Q | A
| ------------- | ---
| Branch? | 4.1 <!-- see below -->
| Bug fix? | yes
| New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #27164 <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | N/A
Seems like we did review a bit fast here 😅
Commits
-------
98967cd73a [Messenger] Fix AMQP Transport factory & TransportFactoryInterface
This PR was merged into the 4.1 branch.
Discussion
----------
[Messenger] Add TransportInterface as first class citizen sender+receiver
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
The current design misses an opportunity to reuse the same connection for the sender and the receiver parts of a transport. By making `TransportInterface` a first class citizen, we simplify the wiring logic, we allow sharing the same connection for both the sender and the receiver, and we provide a natural point to lazily create the connection.
Live from Las Vegas :)
![image](https://user-images.githubusercontent.com/243674/39658543-93c7120c-4fca-11e8-9f11-797953b3ee98.png)
Commits
-------
379b8eb56b [Messenger] Add TransportInterface as first class citizen sender+receiver
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes#27183).
Discussion
----------
Fixed return type
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | no <!-- please add some, will be required by reviewers -->
| Fixed tickets | <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
-->
Note that tests that are failing are not related to this component.
Commits
-------
5539f9d6c8 Fixed return type
This PR was squashed before being merged into the 4.1-dev branch (closes#26945).
Discussion
----------
[Messenger] Support configuring messages when dispatching
| Q | A
| ------------- | ---
| Branch? | master <!-- see below -->
| Bug fix? | no
| New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | see CI checks <!-- please add some, will be required by reviewers -->
| Fixed tickets | N/A <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | todo
For now, this is mainly a RFC to get your opinion on such a feature (so it misses proper tests).
Supporting wrapped messages out-of-the-box would mainly allow to easily create middlewares that should act only or be configured differently for specific messages (by using wrappers instead of making messages implements specific interfaces and without requiring dedicated buses). For instance, I might want to track specific messages and expose metrics about it.
The Symfony Serializer transport (relates to #26900) and Validator middleware serve as guinea pigs for sample purpose here. But despite message validation usually is simple as it matches one use-case and won't require specific validation groups in most cases, I still think it can be useful sometimes. Also there is the case of the [`AllValidator` which currently requires using a `GroupSequence`](https://github.com/symfony/symfony/pull/26477) as a workaround, but that could also be specified directly in message metadata instead.
## Latest updates
PR updated to use a flat version of configurations instead of wrappers, using an `Envelope` wrapper and a list of envelope items.
Usage:
```php
$message = Envelope::wrap(new DummyMessage('Hello'))
->with(new SerializerConfiguration(array(ObjectNormalizer::GROUPS => array('foo'))))
->with(new ValidationConfiguration(array('foo', 'bar')))
;
```
~~By default, Messenger protagonists receive the original message. But each of them can opt-in to receive the envelope instead, by implementing `EnvelopeReaderInterface`.
Then, they can read configurations from it and forward the original message or the envelope to another party.~~
Senders, encoders/decoders & receivers always get an `Envelope`.
Middlewares & handlers always get a message. But middlewares can opt-in to receive the envelope instead, by implementing `EnvelopeReaderInterface`.
Commits
-------
749054a1e8 [Messenger] Support configuring messages when dispatching
This PR was merged into the 4.1-dev branch.
Discussion
----------
Rename middlewares to middleware
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
`middleware` is uncountable in English (like software or information). So, I've removed the `s` everywhere. We can probably be a bit more explicit if we think it makes thing easier to understand like I've done in one class, like `middlewareHandler`.
Commits
-------
9ae7c11805 Do not fix the `middleware` XML name anymore
52e7500edb removed usage of middlewares
This PR was merged into the 4.1-dev branch.
Discussion
----------
[Messenger] Add missing `@experimental` annotations
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ø
| License | MIT
| Doc PR | ø
So we have all the Messenger interfaces tagged with `@experimental`.
Commits
-------
7f875cb52b Add missing `@experimental` annotations
This PR was merged into the 4.1-dev branch.
Discussion
----------
[Messenger] Fix missing s/tolerate_no_handler/allow_no_handler/g
| Q | A
| ------------- | ---
| Branch? | master <!-- see below -->
| Bug fix? | yes
| New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | N/A <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | N/A
Spotted while rebasing #26945: some places weren't updated. Most are in tests and not that much important but should be updated for consistency. But moreover, the `AllowNoHandlerMiddleware` wiring in DI was still referencing the old class name.
Commits
-------
e7cfb59480 [Messenger] Fix missing s/tolerate_no_handler/allow_no_handler/g