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-dev branch.
Discussion
----------
[FrameworkBundle][Messenger] Remove convention-based service id generation for buses
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes (DX)
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Service ids for buses are user facing ids: ppl *will* have to deal with them when wiring their services.
Like for cache pools, we should ask ppl to declare them using full identifiers, instead of having a convention-based way to turn a name into and id (which is something nobody will be able to remember at some point.)
Commits
-------
c7a0045cbd [FrameworkBundle][Messenger] Remove convention-based service id generation for buses
This PR was merged into the 4.1-dev branch.
Discussion
----------
[Messenger] Relax messenger config and fix some bugs
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
After playing a little with the config of this component I found some bugs around.
Reproducer:
1. Install a fresh Symfony flex project with `^4.0@dev` dependencies
2. Add the `symfony/messenger` requirement
3. Add the following configuration separately:
Note that `symfony/serializer` has not been installed yet. ATM it's not required.
----------------------
Configuring my custom transport (not amqp):
```yaml
framework:
messenger:
transports:
custom: 'my_transport://localhost/msgs'
routing:
'*': custom
```
**Before** (Current behaviour):
Threw a logic exception, IMO unrelated at this point:
> Using the default encoder/decoder, Symfony Messenger requires the Serializer. Enable it or install it by running "composer require symfony/serializer-pack".
**After** (Proposal):
Pass! The Messenger's serializer config is disabled by definition because the Serializer component is not installed yet, then the related (default) encoder/decoder aliases are invalid, so the amqp transport factory service is removed altogether.
----------------------
According to the previous exception I configured my custom encoder/decoder services:
```yaml
framework:
messenger:
encoder: App\Serializer\Serializer
decoder: App\Serializer\Serializer
transports:
custom: 'my_transport://localhost/msgs'
routing:
'*': custom
```
**Before**:
The same exception has been thrown, now a bit vague according to the config:
> Using the default encoder/decoder, Symfony Messenger requires the Serializer. Enable it or install it by running "composer require symfony/serializer-pack".
**After**:
Pass! the serializer is disabled by definition but there is custom encoder/decoder services, so let's keep the amqp transport factory with their custom encoder/decoder deps.
----------------------
Just enabling the serializer option:
```yaml
framework:
messenger:
serializer: true
```
**Before**:
Pass! Unexpected, as there is no transport configuration the exception wasn't thrown and still keeps the amqp transport factory service with invalid encoder/decoder (Serializer) dependencies.
**After**:
The Serializer config & support is verified if it's enabled regardless of the transport configuration and this exception is thrown for this case:
> The default Messenger serializer cannot be enabled as the Serializer support is not enabled.
I've removed the "install" part because at this point only we're checking whether the `framework.serializer` is enabled or not, so the next step after that should be enable the Serializer support in `framework.serializer`, which already verify whether the Serializer component is installed or not. IMO "composer require symfony/serializer-pack" should be there and not here. Also because `symfony/serializer` is not a hard dependency of this component.
----------------------
By last, I disabled the serializer option manually:
```yaml
framework:
messenger:
serializer: false
transports:
custom: 'my_transport://localhost/msgs'
routing:
'*': custom
```
**Before**:
I received this DI exception:
> The service "messenger.transport.amqp.factory" has a dependency on a non-existent service "messenger.transport.serializer".
**After**:
Pass! (same behaviour that the first example)
----------------------
As I explained earlier, this PR enables or disables the Messenger's serializer config based on the current Symfony platform and whether the Serializer component is installed or not, like other config with similar behaviour.
Tests included :)
Cheers!
Commits
-------
a05e2e2c3b Relax Messenger config and fix some bugs
* 4.0:
use brace-style regex delimiters
Fixed typo RecursiveIterator -> RecursiveIteratorIterator
[Cache] fix logic for fetching tag versions on TagAwareAdapter
[FrameworkBundle] Remove dead code
[FrameworkBundle] Use the correct service id for CachePoolPruneCommand in its compiler pass
Hide short exception trace by default
[Doctrine Bridge] fix priority for doctrine event listeners
[Validator] make phpdoc of ObjectInitializerInterface interface more accurate
[Validator] fixes phpdoc reference to an interface that was removed in Symfony 3.0
* 3.4:
use brace-style regex delimiters
Fixed typo RecursiveIterator -> RecursiveIteratorIterator
[Cache] fix logic for fetching tag versions on TagAwareAdapter
[FrameworkBundle] Use the correct service id for CachePoolPruneCommand in its compiler pass
Hide short exception trace by default
[Doctrine Bridge] fix priority for doctrine event listeners
[Validator] make phpdoc of ObjectInitializerInterface interface more accurate
[Validator] fixes phpdoc reference to an interface that was removed in Symfony 3.0
This PR was merged into the 3.4 branch.
Discussion
----------
[Console] By default hide the short exception trace line from exception messages in Symfony's commands
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
After https://github.com/symfony/symfony/pull/24131 this was in my contribution list since then.
Maybe it should be taken as a good practice when we build console commands, **use the exception classes of the Console component as much as possible to show a better message style to the end user**.
(See the before/after effect in the referenced PR)
Commits
-------
11f3c455d4 Hide short exception trace by default
This PR was merged into the 4.1-dev branch.
Discussion
----------
[FrameworkBundle] Hide some lock-related services
| 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 | -
I don't know why, but I missed these in #26921
Commits
-------
d06d8b2573 [FrameworkBundle] Hide some lock-related services
* 4.0:
PhpDoc: There is no attempt to create the directory
Avoiding an error when an unused service has a missing base class
Add an implementation just for php 7.0
bumped Symfony version to 2.7.47
Fix#27011: Session ini_set bug
[Cache] TagAwareAdapterInterface::invalidateTags() should commit deferred items
updated VERSION for 2.7.46
update CONTRIBUTORS for 2.7.46
updated CHANGELOG for 2.7.46
bug #25844 [HttpKernel] Catch HttpExceptions when templating is not installed
* 3.4:
PhpDoc: There is no attempt to create the directory
Avoiding an error when an unused service has a missing base class
Add an implementation just for php 7.0
bumped Symfony version to 2.7.47
Fix#27011: Session ini_set bug
[Cache] TagAwareAdapterInterface::invalidateTags() should commit deferred items
updated VERSION for 2.7.46
update CONTRIBUTORS for 2.7.46
updated CHANGELOG for 2.7.46
bug #25844 [HttpKernel] Catch HttpExceptions when templating is not installed
This PR was merged into the 4.1-dev branch.
Discussion
----------
[Messenger][DX] Validate that the message exists to be able to configure its routing
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ø
| License | MIT
| Doc PR | ø
It attempted to me already: mispelling the message name and not understanding why it didn't work... An exception letting me know that the configured message does not exists will be 👌
Commits
-------
04d87ca829 Validate that the message exists to be able to configure its routing Uses an existing class in the tests... :) Only trigger the autoloading once
This PR was merged into the 4.1-dev branch.
Discussion
----------
[Messenger] Add a memory limit option for `ConsumeMessagesCommand`
| Q | A
| ------------- | ---
| Branch? | master for features
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
New feature to add a memory limit option to the ConsumeMessagesCommand.
```
bin/console messenger:consume-messages <receiver-name> -m 128
```
Commits
-------
08f98cfaf1 [Messenger] Add a memory limit option for `ConsumeMessagesCommand`
This PR was squashed before being merged into the 4.1-dev branch (closes#26864).
Discussion
----------
[Messenger] Define multiple buses from the `framework.messenger.buses` configuration
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #26652
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/issues/9617
Not everybody will benefit from having only one bus, especially with the CQRS-like usages. While keeping the extremely use of use of the single bus, this PR has the following:
- Create multiple buses from the YAML configuration
- Tag middleware only a specific buses
- Register middlewares from the YAML configuration
Even if it's visible in the PR's tests, here's how it will look like, for a completely full-customised version:
```yaml
framework:
messenger:
default_bus: commands
buses:
commands: ~
events:
middlewares:
- validation
- route_messages
- "Your\\Middleware\\Service"
- call_message_handler
```
A few things to note:
1. The YAML configuration creates `messenger.bus.[name]` services for the buses.
2. The YAML configuration for middleware just adds tags to the corresponding middlewares.
3. If the middleware definition does not exists, it creates it. (without any magic on the arguments though, if it isn't auto-wirable, well... "your problem")
4. In the PR, there is this "TolerateNoHandler" middleware that is a great example for event buses
Commits
-------
e5deb8499b [Messenger] Define multiple buses from the `framework.messenger.buses` configuration
Before this fix, only services explicitly configured with public=false were exposed via the test service container:
```
$container->register(PrivateService::class, PrivateService::class)->setPublic(false);
```
but not those explicitly configured as private:
```
$container->register(PrivateService::class, PrivateService::class)->setPrivate(true);
```
nor those implicitly configured as private:
```
$container->register(PrivateService::class, PrivateService::class);
```
This PR was merged into the 4.1-dev branch.
Discussion
----------
[DI][FrameworkBundle] Hide service ids that start with a dot
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | #26630
| License | MIT
| Doc PR | -
Now that services are private by default, `debug:container` should display them by default.
In fact, the public/private concept should not trigger a difference in visibility for this command.
Instead, I propose to handle service ids that start with a dot as hidden services.
PR should be ready.
(For reference, I tried using a tag instead in #26891, but that doesn't work in practice when working on the implementation.)
Commits
-------
cea051ee5e [DI][FrameworkBundle] Hide service ids that start with a dot
* 4.0:
Fix tests
PropertyInfo\DoctrineExtractor - There is bug when indexBy is meta key
Fix PercentType error rendering.
[minor] SCA
[Cache] Inline some hot function calls
fixed Silex project's URL
fixed deprecations in tests
fixed Twig URL
[Cache] Add missing `@internal` tag on ProxyTrait
fix formatting arguments in plaintext format
Fix PSR exception context key
Don't assume that file binary exists on *nix OS
Fix that ESI/SSI processing can turn a \"private\" response \"public\"
[Form] Fixed trimming choice values
fix rendering exception stack traces
[Routing] Fix loading multiple class annotations for invokable classes
* 3.4:
Fix tests
PropertyInfo\DoctrineExtractor - There is bug when indexBy is meta key
Fix PercentType error rendering.
[minor] SCA
[Cache] Inline some hot function calls
This PR was squashed before being merged into the 4.1-dev branch (closes#26941).
Discussion
----------
[Messenger] Allow to configure the transport
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | ish
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #26900, #26908, #26935
| License | MIT
| Doc PR | ø
We allow users to configure the encoder/decoder used by the built-in adapter(s). This also adds the support of configuring the default's encoder/decoder format and context.
Commits
-------
1a3f0bbb14 [Messenger] Allow to configure the transport