Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Notifier] [Bridges] Provide EventDispatcher and HttpClient to the transport#52998

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:5.4fromrdavaillaud:fix_52997
Dec 20, 2023

Conversation

@rdavaillaud
Copy link
Contributor

QA
Branch?5.4
Bug fix?yes
New feature?no
Deprecations?no
IssuesFix#52997
LicenseMIT

Some Notifier transport factories are redefining the class constructor, but aren't passing the HttpClient nor the EventDispatcher.
As a result, those transports are not providing Notifier event hooks.

This PR adds those dependencies.

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.1 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@OskarStark
Copy link
Contributor

Hi, thanks for the PR, as this is a new feature, please target 7.1

@OskarStarkOskarStark modified the milestones:5.4,7.1Dec 12, 2023
@rdavaillaud
Copy link
ContributorAuthor

rdavaillaud commentedDec 12, 2023
edited
Loading

Hi, thanks for the PR, as this is a new feature, please target 7.1

Is it really a new feature or an oversight?
TheNotifier component documentation tells us that the transport use Event to interact in the lifecycle of the event

TheTransport class of the Notifier component allows you to optionally hook into the lifecycle via events.

Currently, the hooks aren't working with the FakeSms/FakeChat and Mercure as they should.

@OskarStark
Copy link
Contributor

Not sure, from a technical POV it is a new feature, because they were never meant to dispatch those events, but I can understand your point.

cc@nicolas-grekas

@rdavaillaud
Copy link
ContributorAuthor

I will give some argument in favour of a bugfix 😁

Those transports (at least the Fake* ones) are intended to be used in dev/test, but we cannot test the events behaviours, and it is not documented that they don't support those events.

Technically, the transports classdoes have everything to support the dispatch of those events, they correctly extends the AbstractTransport class and call the extended class constructor passing the two HttpClient and EventDispatcher argument.

The factories, in the other hand, don't handle the extended AbstractTransportFactory class constructor arguments. As all the other factories don't override the constructor, there is no precedent.
As those 3 specific ones need to override the constructor, I see no point not to pass them.

@fabpot , as you are the designer of the component and in order to determine if this is bug since 5.3 or a new feature for 7.x., do you have an opinion on that : does every TransportFactory need to pass EventDispatcher and HttpClient ?

I will target whichever you finally decide, tell me.

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

Works as a bugfix to me. It's surprising that we'd rely on the default http client on purpose.
Can you also remove the use of named arguments? We don't use them in core except here and it looks like an oversight.
Can you please check on 6.4/7.1 if there are more bridges that would need a similar change and submit a PR if yes?

@fabpot
Copy link
Member

Thank you@rdavaillaud.

@fabpotfabpot merged commitac3141a intosymfony:5.4Dec 20, 2023
@rdavaillaudrdavaillaud deleted the fix_52997 branchDecember 20, 2023 09:26
@rdavaillaud
Copy link
ContributorAuthor

Can you also remove the use of named arguments? We don't use them in core except here and it looks like an oversight.

I will try to see what I can do with this, I need to dig in and understand why. I would open a PR then.

Can you please check on 6.4/7.1 if there are more bridges that would need a similar change and submit a PR if yes?

From what I can see, those three bridges are the only ones.

This was referencedDec 30, 2023
@OskarStark
Copy link
Contributor

Behause we missed to add a conflict in FrameworkBundle 6.4.2 to require fake-chat and fake-sms at least in 6.4.2 ends up in the following error:

Invalid service "notifier.transport_factory.fake-sms": method "Symfony\Component\Notifier\Bridge\FakeSms\FakeSmsTransportFactory::__construct()" has no argument named "$client". Check your service definition.

The solution is to upgrade the notifier bridges to6.4.2 first

cc@xabbuh

@xabbuh
Copy link
Member

xabbuh commentedJan 2, 2024
edited
Loading

The same issue should be observable too when updating FrameworkBundle from 5.4.33 to 5.4.34, 6.3.10 to 6.3.11 or from 7.0.1 to 7.0.2 without also upgrading these bridges.

OskarStark reacted with thumbs up emoji

@rdavaillaud
Copy link
ContributorAuthor

Damn, I am not used to those dependencies conflicts, sorry. What are the rules I missed?
Can I do something to mitigate the issue ?

I suppose removing the use of named arguments as requested by@nicolas-grekas is the way to go, but I didn't worked on this until now. And this will maybe need some other things to do in composer that I don't know of.

@OskarStark, as you are the first contributor on these bridges, can you explain to me why was it necessary at the first place to put those lines in Framework Bundle? This may put me in the fast lane to understand.

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedJan 2, 2024
edited
Loading

Removing named arguments is the way to go, no need for anything else (no conflicts).

rdavaillaud and OskarStark reacted with thumbs up emoji

@xabbuh
Copy link
Member

see#53341

nicolas-grekas added a commit that referenced this pull requestJan 2, 2024
…non-existent named-arguments (xabbuh)This PR was merged into the 5.4 branch.Discussion----------[FrameworkBundle] append instead of replacing potentially non-existent named-arguments| Q             | A| ------------- | ---| Branch?       | 5.4| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Issues        |Fix#52998 (comment)| License       | MITCommits-------96d2e68 append instead of replacing potentially non-existent named-arguments
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@fabpotfabpotfabpot approved these changes

@OskarStarkOskarStarkAwaiting requested review from OskarStarkOskarStark is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

6 participants

@rdavaillaud@carsonbot@OskarStark@fabpot@xabbuh@nicolas-grekas

[8]ページ先頭

©2009-2025 Movatter.jp