Closed rpkamp closed 4 years ago
I think the idea is good. You are right, that in this case we can remove a lot of code and to reduce the complexity. If @florianpreusner is ok with change, then we can: 1) do one more commit with deprecation on v7 and one more minor version 2) to refactor events in master and this change will be in v8 3) describe guide how to upgrade events from v7 to v8 in UPGRADE.md
@florianpreusner what do you think? do you see any bottlenecks?
A very nice idea! I don't see any disadvantages. 👍 👍 👍
@rpkamp please let us know, if you have desire to integrate these change in v8?
Yes, I'd be happy to do that :)
But I'll first send a PR for the deprecation in 7.x :smile:
@rpkamp Ok, greate! If you want, I can do that. Just write.
No, I'm happy to do it :slightly_smiling_face:
This done now (PRs https://github.com/8p/EightPointsGuzzleBundle/pull/287 and https://github.com/8p/EightPointsGuzzleBundle/pull/284), I'll close this issue :)
For the PRE_TRANSACTION and POST_TRANSACTION events I'd like to propose two events should be fired for each request/response, instead of one.
The generic event can be used by listeners who want to do stuff like logging, tracing, profiling, auditing, etc. The specific events can be used by listeners/subscribers that want to do something specific for a specific client (like auth headers etc).
Basically:
So suppose I have a client called
payment
and a client calledcrm
. I can:eight_points_guzzle.pre_transaction
to get all events for both (and future) clientseight_points_guzzle.pre_transaction.payment
for all events from thepayment
client onlyeight_points_guzzle.pre_transaction.crm
for all events from thecrm
client onlyThis would have several advantages:
if ($event->getServiceName() !== $this->serviceName) { return; }
), they can subscribe to a specific client and not be bothered with events from other clients (which indeed means that\EightPoints\Bundle\GuzzleBundle\Events\GuzzleEventListenerInterface
can be deprecated)\EightPoints\Bundle\GuzzleBundle\Events\GuzzleEventListenerInterface
is removed,\EightPoints\Bundle\GuzzleBundle\DependencyInjection\Compiler\EventHandlerCompilerPass
can be removed as well, as it doesn't serve a purpose anymore.Thoughts? :slightly_smiling_face: