api-platform / api-platform/core

Add @type or @context (or both) properties to Mercure data when object is deleted

未關閉
#8,062 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
PHP
星號
2.6k
分支
980
平均合併
2 天 4 小時
30 天內合併 PR
49

描述

**Description**
Currently, the data of the Mercure update contains only the IRI of the removed object inside the `@id` property. This is enough for cases where topics are created for specific collections or items. More generic topics containing updates for several collections force the subscriber to parse the IRI to identify the affected collection. Unfortunately, for some collections, this requires writing a code which is difficult to maintain. An example of such an issue would be a collection of `Person` entities. The prefix for such entities is `/people/`. Adding the `@type` in the case of update/create events would make it easier for the subscriber to identify the affected collection.

**Example**
The `data` of the event would change from:
```
{"@id":"\/people\/1ed69b32-4697-68fc-9f20-e17dcbef2976"}
```
to:
```
{"@type":"Person", "@id":"\/people\/1ed69b32-4697-68fc-9f20-e17dcbef2976"}
```

I can create a PR if this is accepted.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。