core icon indicating copy to clipboard operation
core copied to clipboard

[feat] Mercure doesn't use state provider when publishing updates

Open divine opened this issue 10 months ago • 0 comments

API Platform version(s) affected: 4.1.7

Description
Mercure doesn't use entity's state provider when publishing updates

How to reproduce

Let's say you've this in your operations:

new Get(
    provider: ExampleProvider::class,
),

and your ExampleProvider returns a calculated field or extra data from another database.

Mercure publish update listener simply doesn't take into account entity's provider.

Possible Solution

Looks like it's only supports seriliazer:

https://github.com/api-platform/core/blob/f48a2be39f3bc3cabfdafcb98a270f6675762231/src/Symfony/Doctrine/EventListener/PublishMercureUpdatesListener.php#L242-L249 Additional Context

Thanks!

divine avatar Apr 13 '25 06:04 divine