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
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
This PR was squashed before being merged into the 4.1-dev branch (closes#26909).
Discussion
----------
[Messenger][DX] Uses the adapter name instead of the service name
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ø
| License | MIT
| Doc PR | ø
As a developer, I don't get why I would need to use the service name while I give a name to the adapters. This is basically what this PR means for me in terms of configuration:
```patch
framework:
messenger:
routing:
# We want the command below to be handled async with the "messenger.default_sender" (AMQP producer).
- 'App\Message\Command\CreateNumber': messenger.sender.amqp
+ 'App\Message\Command\CreateNumber': amqp
adapters:
amqp: "%env(AMQP_DSN)%"
```
And in terms of pulling the messages:
```patch
- bin/console messenger:consume-messages messenger.receiver.amqp
+ bin/console messenger:consume-messages amqp
```
Commits
-------
b5afb40441 [Messenger][DX] Uses the adapter name instead of the service name
This PR was squashed before being merged into the 4.1-dev branch (closes#26632).
Discussion
----------
[Messenger] Add AMQP adapter
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | ø
| License | MIT
- [x] Depends on the Messenger component #24411
- [x] Add tests once we are all happy about the structure
---
In order to give a great DX for simple needs such as sending messages through an AMQP broker such as RabbitMq, we should ship an AMQP adapter for the Messenger component within Symfony Core. It should be as simple as this proposal. We don't need to handle more specific use-cases nor brokers as other adapters such as the [enqueue adapter](https://github.com/sroze/enqueue-bridge) can also be used.
Configuring the adapter is as simple as the following configuration:
```yaml
# config/packages/messenger_adapters.yaml
framework:
messenger:
adapter: "%env(MESSENGER_DSN)%"
```
With the given `.env` for example:
```
MESSENGER_DSN=amqp://guest:guest@localhost:5672/%2f/messages
```
Keep in mind that after having configured the adapter, developers have to route their messages to the given adapter.
```yaml
# config/packages/messenger_routes.yaml
framework:
messenger:
routing:
producer).
'App\Message\Command\CreateNumber': messenger.default_sender
```
---
Additionally, multiple adapters can be created and messages routed to these ones.
```yaml
# config/packages/messenger_routes.yaml
framework:
messenger:
adapters:
commands: "amqp://guest:guest@localhost:5672/%2f/commands"
maintenance: "amqp://guest:guest@localhost:5672/%2f/maintenance"
routing:
producer).
'App\Message\Command\CreateNumber': messenger.commands_sender
'App\Message\Command\MaintenanceSpecificCommand': messenger.maintenance_sender
```
Commits
-------
798c230ad5 [Messenger] Add AMQP adapter
* 4.0: (24 commits)
moved Twig runtime to proper class
fixed deprecated messages in tests
add PHP errors options to XML schema definition
[HttpCache] Unlink tmp file on error
Added LB translation for #26327 (Errors sign for people that do not see colors)
[TwigBridge] Fix rendering of currency by MoneyType
Import InvalidArgumentException in PdoAdapter
[DI] Do not suggest writing an implementation when multiple exist
[Intl] Update ICU data to 61.1
Use 3rd person verb form in command description
[Validator] Add Japanese translation
Support phpdbg SAPI in Debug::enable()
[HttpKernel] DumpDataCollector: do not flush when a dumper is provided
[DI] Fix hardcoded cache dir for warmups
[Routing] fix tests
[Routing] Fixed the importing of files using glob patterns that match multiple resources
[Ldap] cast to string when checking empty passwords
[Validator] sync validator translation id
[WebProfilerBundle] use the router to resolve file links
no type errors with invalid submitted data types
...
* 3.4: (24 commits)
moved Twig runtime to proper class
fixed deprecated messages in tests
add PHP errors options to XML schema definition
[HttpCache] Unlink tmp file on error
Added LB translation for #26327 (Errors sign for people that do not see colors)
[TwigBridge] Fix rendering of currency by MoneyType
Import InvalidArgumentException in PdoAdapter
[DI] Do not suggest writing an implementation when multiple exist
[Intl] Update ICU data to 61.1
Use 3rd person verb form in command description
[Validator] Add Japanese translation
Support phpdbg SAPI in Debug::enable()
[HttpKernel] DumpDataCollector: do not flush when a dumper is provided
[DI] Fix hardcoded cache dir for warmups
[Routing] fix tests
[Routing] Fixed the importing of files using glob patterns that match multiple resources
[Ldap] cast to string when checking empty passwords
[Validator] sync validator translation id
[WebProfilerBundle] use the router to resolve file links
no type errors with invalid submitted data types
...
* 2.8:
fixed deprecated messages in tests
[HttpCache] Unlink tmp file on error
Added LB translation for #26327 (Errors sign for people that do not see colors)
[TwigBridge] Fix rendering of currency by MoneyType
[HttpKernel] DumpDataCollector: do not flush when a dumper is provided
* 2.7:
[HttpCache] Unlink tmp file on error
Added LB translation for #26327 (Errors sign for people that do not see colors)
[TwigBridge] Fix rendering of currency by MoneyType
[HttpKernel] DumpDataCollector: do not flush when a dumper is provided
This PR was squashed before being merged into the 4.1-dev branch (closes#26682).
Discussion
----------
Improved the lint:xliff command
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #26537
| License | MIT
| Doc PR | -
This is how it looks:
![lint-xliff-output](https://user-images.githubusercontent.com/73419/37958502-fd8732e0-31b0-11e8-8688-8644ca930daf.png)
Commits
-------
6bbcc45d96 Improved the lint:xliff command
This PR was squashed before being merged into the 4.1-dev branch (closes#26647).
Discussion
----------
[Messenger] Add a middleware that wraps all handlers in one Doctrine transaction.
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | na
| License | MIT
| Doc PR | coming up
This is greatly inspired by SimpleBus. This middleware will rollback a transaction if the message handler throws an exception.
Commits
-------
623dc5fb16 [Messenger] Add a middleware that wraps all handlers in one Doctrine transaction.
This PR was merged into the 4.1-dev branch.
Discussion
----------
[FrameworkBundle] keep query in redirect
| Q | A
| ------------- | ---
| Branch? | 4.1
| 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 files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #26256 <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | #9314
<!--
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.
-->
Commits
-------
406bfc9896 [FrameworkBundle] keep query params in redirection
This PR was merged into the 4.1-dev branch.
Discussion
----------
[Workflow] Add a MetadataStore to fetch some metadata
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | yes (little)
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | #23257
| License | MIT
| Doc PR | TODO
---
This is an attempt to fix#23257. I first started to implement
`Ẁorkflow::getMetadata()`, `Transition::getMetadata()` and
`Place::getMetadata()`. **BUT**, there are no `Place` class. For now it's just a
`string`. So dealing with BC is a nightmare.
So I tried to find another way to fix the issue. [This
comment](https://github.com/symfony/symfony/issues/23257#issuecomment-315551397)
summary well the two options. But this PR is (will be) a mix of theses 2
options.
First it will be possible to configure the workflow/metadata like this:
```yaml
blog_publishing:
supports:
- AppBundle\Entity\BlogPost
metada:
label: Blog publishing
description: Manages blog publishing
places:
draft:
metadata:
description: Blog has just been created
color: grey
review:
metadata:
description: Blog is waiting for review
color: blue
transitions:
to_review:
from: draft
to: review
metadata:
label: Submit for review
route: admin.blog.review
```
I think is very good for the DX. Simple to understand.
All metadata will live in a `MetadataStoreInterface`. If metadata are set via
the configuration (workflows.yaml), then we will use the
`InMemoryMetadataStore`.
Having a MetadataStoreInterface allow user to get dynamic value for a place /
transitions. It's really flexible. (But is it a valid use case ?)
Then, to retrieve these data, the end user will have to write this code:
```php
public function onReview(Event $event) {
$metadataStore = $event->getWorkflow()->getMetadataStore();
foreach ($event->getTransition()->getTos() as $place) {
$this->flashbag->add('info', $metadataStore->getPlaceMetadata($place)->get('description'));
}
}
```
Note: I might add some shortcut to the Event class
or in twig:
```jinja
{% for transition in workflow_transitions(post) %}
<a href="{{ workflow_metadata_transition(post, route) }}">
{{ workflow_metadata_transition(post, transition) }}
</a>
{% endfor %}
```
---
WDYT ?
Should I continue this way, or should I introduce a `Place` class (there will be
so many deprecation ...)
Commits
-------
bd1f2c8583 [Workflow] Add a MetadataStore
This PR was merged into the 4.1-dev branch.
Discussion
----------
[FrameworkBundle] feature: add the ability to search a route
| Q | A
| ------------- | ---
| Branch? | 4.1
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | #26033
| License | MIT
| Doc PR | symfony/symfony-docs#9236
This add the ability to search a route in the debug:router command.
![img_3271](https://user-images.githubusercontent.com/3451634/36034017-e60cbfda-0db2-11e8-841a-60bc75b0b631.jpeg)
Commits
-------
ef0df02afc [FrameworkBundle] feature: add the ability to search a route
* 4.0: (32 commits)
[Form] fix tests and deps
[Cache] Rely on mock for Doctrine ArrayCache
[FrameworkBundle] Respect debug mode when warm up annotations
[Console] Fix docblock of DescriptorInterface::describe
[Config] Handle nullable node name + fix inheritdocs
[Security] added userChecker to SimpleAuthenticationProvider
[Debug] fix test
Fix typo in test method name
Fixes#26563 (open_basedir restriction in effect)
[Debug] Reset previous exception handler ealier to prevent infinite loop
add hint in Github pull request template
[Validator] Fix docblock of ClassMetadata#members
[BrowserKit] Fix cookie path handling when $domain is null
[DoctrineBridge] Don't rely on ClassMetadataInfo->hasField in DoctrineOrmTypeGuesser anymore
[BrowserKit] Improves CookieJar::get
[BrowserKit] Fix Cookie's PHPDoc
[DomCrawler] Change bad wording in ChoiceFormField::untick
[DomCrawler] Fix the PHPDoc of ChoiceFormField::setValue
[DomCrawler] Avoid a useless call to strtolower
[FrameworkBundle] HttpCache is not longer abstract
...
* 3.4: (32 commits)
[Form] fix tests and deps
[Cache] Rely on mock for Doctrine ArrayCache
[FrameworkBundle] Respect debug mode when warm up annotations
[Console] Fix docblock of DescriptorInterface::describe
[Config] Handle nullable node name + fix inheritdocs
[Security] added userChecker to SimpleAuthenticationProvider
[Debug] fix test
Fix typo in test method name
Fixes#26563 (open_basedir restriction in effect)
[Debug] Reset previous exception handler ealier to prevent infinite loop
add hint in Github pull request template
[Validator] Fix docblock of ClassMetadata#members
[BrowserKit] Fix cookie path handling when $domain is null
[DoctrineBridge] Don't rely on ClassMetadataInfo->hasField in DoctrineOrmTypeGuesser anymore
[BrowserKit] Improves CookieJar::get
[BrowserKit] Fix Cookie's PHPDoc
[DomCrawler] Change bad wording in ChoiceFormField::untick
[DomCrawler] Fix the PHPDoc of ChoiceFormField::setValue
[DomCrawler] Avoid a useless call to strtolower
[FrameworkBundle] HttpCache is not longer abstract
...