Skip to content
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

[Messenger] Wire the transaction middleware factory when component is enabled #817

Merged

Conversation

ogizanagi
Copy link
Contributor

@ogizanagi ogizanagi commented May 11, 2018

Relates to symfony/symfony#27128

How should we process for the CI?

composer.json Outdated
@@ -61,5 +62,6 @@
"branch-alias": {
"dev-master": "1.9.x-dev"
}
}
},
"minimum-stability": "dev"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should that really be added?

Copy link
Contributor Author

@ogizanagi ogizanagi May 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be required to get the beta2 until released, but I don't think it'll stay here. That was just the way to install it locally for me.
Anyway, I'm waiting some instructions/plans/help to deal with the CI as we're even unlikely to keep the messenger component in require-dev due to the sf 2.7 support in this bundle.

public function process(ContainerBuilder $container)
{
// Remove wired services if the Messenger component actually isn't enabled:
if (!$container->hasAlias('message_bus') || !is_subclass_of($container->findDefinition('message_bus')->getClass(), MessageBusInterface::class, true)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 3rd argument of is_subclass_of() is already true by default, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true :)

PHP API consistency (see is_a) tricked me!

@ogizanagi ogizanagi force-pushed the messenger/transaction_middleware_factory branch from 6a7bbc6 to cf4d445 Compare May 11, 2018 15:33
@ogizanagi ogizanagi force-pushed the messenger/transaction_middleware_factory branch 2 times, most recently from 1fb8719 to 4fa24cd Compare May 14, 2018 10:40
@ogizanagi
Copy link
Contributor Author

ogizanagi commented May 14, 2018

Should be ready. New tests on the new travis build should not be skipped anymore once symfony/symfony#27128 is merged.

@@ -676,6 +677,31 @@ public function testAnnotationsBundleMappingDetectionWithVendorNamespace()
$this->assertEquals('Fixtures\Bundles\Vendor\AnnotationsBundle\Entity', $calls[0][1][1]);
}

public function testMessengerIntegration()
{
if (! interface_exists(MessageBusInterface::class)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd argue that it should be a dev-dependency, otherwise it's untested.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I though symfony/symfony was used on CI for specific versions. So I expected it to be available in the new build.
The issue with adding it into the dev-dependencies (see first commit) is that it'll conflict with lowest dependencies tested for this packages due to the component requirements. So it must be explicitly added on a specific build. WDYT?

Copy link
Contributor

@Majkl578 Majkl578 May 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can override it for now using ^4.1@beta, the @beta part would be dropped once 4.1 is stable. But yes, it wouldn't allow SF pre-3.4. Since there is only one (or two) CI job to test SF 2.x, I think it'd be better to drop this dependency only in such job.
(Another argument for dropping 2.x support soon.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would actually require dropping symfony/messenger for every build without PHP 7.1, a minimum-stability: dev or with a specific SYMFONY_VERSION except for the new 4.1-beta2 one, as the component is only available since 4.1 and the required classes would be part of the beta2 (so it'll be quite a mess).
For now, I've just added the symfony/messenger component on the new build, so this build will pass once the related PR on symfony/symfony is merged.
But if there is a better strategy to you, please feel free to push the required changes to my branch :) Thank you!

@ogizanagi ogizanagi force-pushed the messenger/transaction_middleware_factory branch 3 times, most recently from ca8c487 to 1436d7a Compare May 14, 2018 14:20
@sroze
Copy link
Contributor

sroze commented May 14, 2018

PR has been merged on Symfony 👍

@ogizanagi ogizanagi force-pushed the messenger/transaction_middleware_factory branch from 1436d7a to 0a39dc9 Compare May 14, 2018 19:25
@ogizanagi
Copy link
Contributor Author

And it's now green. Also tested on a real app, works perfectly fine :)

@weaverryan
Copy link
Contributor

Can you open a docs PR on Symfony too?

@ogizanagi
Copy link
Contributor Author

@weaverryan : Done in symfony/symfony-docs#9774

javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request May 24, 2018
…iereguiluz)

This PR was merged into the 4.1 branch.

Discussion
----------

[Messenger] Document middleware factories

<!--

If your pull request fixes a BUG, use the oldest maintained branch that contains
the bug (see https://symfony.com/roadmap for the list of maintained branches).

If your pull request documents a NEW FEATURE, use the same Symfony branch where
the feature was introduced (and `master` for features of unreleased versions).

-->

Refs:

- Symfony PR: symfony/symfony#27128
- DoctrineBundle PR: doctrine/DoctrineBundle#817

Commits
-------

c5ef7c8 Reowrd to restore the original meaning
a87f21b Minor rewords
2880027 [Messenger] Document middleware factories
@ogizanagi ogizanagi force-pushed the messenger/transaction_middleware_factory branch from 0a39dc9 to f9ba543 Compare May 30, 2018 16:09
@ogizanagi
Copy link
Contributor Author

Symfony 4.1 is released. Could we move forward with this one now? :)

(Note: Code styles issues are not related to these changes)

@ogizanagi
Copy link
Contributor Author

Hi there 👋 Any update?
Symfony 4.1 is released since a month now, it would be awesome for end-users to be able to use the transaction middleware out-of-the-box thanks to this :)

@sroze
Copy link
Contributor

sroze commented Jul 26, 2018

Anybody? :)

@Nyholm
Copy link
Contributor

Nyholm commented Aug 26, 2018

Friendly ping

Copy link
Contributor

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ogizanagi Could you fix the CS issues (see Travis)

Ping @kimhemsoe could you have a look on this PR?

@ogizanagi
Copy link
Contributor Author

@Nyholm : As mentioned previously, these CS issues aren't actually related to this PR :)

@kimhemsoe
Copy link
Member

@ogizanagi Thanks

@kimhemsoe kimhemsoe merged commit 140fb6d into doctrine:master Sep 12, 2018
@ogizanagi ogizanagi deleted the messenger/transaction_middleware_factory branch September 12, 2018 20:31
@sroze
Copy link
Contributor

sroze commented Sep 13, 2018 via email

@kimhemsoe kimhemsoe added this to the 1.9.2 milestone Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants