Skip to content

Broadcast identifier for removed related entities #9912

@pdyck

Description

@pdyck

Feature Description

Given a cascading one-to-many relationship where post contains category: a subscriber listening to remove events for category will never receive any data about the category if it was removed by cascade from saving a post. The subscriber will only ever know that there is a remove event but not which category is affected.

The Solution

The subject executor passes the subject identifier to the broadcaster for all remove, soft remove and recover events. The broadcaster uses the identifier as a fallback to set entityId for the events if the database entity is undefined.

Considered Alternatives

The presented solution is a minimal approach that only broadcasts the entity's identifier instead of the complete entity. Another approach would be to load the related entities from the database. However, from previous conversations in other issues I got the impression that this is not feasible.

Additional Context

No response

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

Yes, I have the time, but I don't know how to start. I would need guidance.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions