Skip to content

Emit an event when a ContentWorkflow transition is flushed #129

@alexander-schranz

Description

@alexander-schranz

The ContentWorkflow service allows to apply a transition on a contentRichEntity and given dimensionAttributes. For example, publishing the content of a specific language is possible by applying the publish transition of the ContentWorkflow.

The ContentWorkflow service builds upon the Symfony Workflow component. Therefore, the service already emits various events when a transition is applied. These allow to execute additional logic when a specific transition is executed inside of a project.

The existing events emitted by the ContentWorkflow service already cover a lot of cases. But in some cases it makes sense to execute the additional logic only if the changes of the transition are flushed to the database. For example, this makes sense when building a search index for some entity.

Executing something only if a transition is flushed is a tricky problem because the SuluContentBundle does not flush anything to the database by itself, but relies on the project to flush changes at an appropriate time. Unfortunately, this makes it hard to use the events of the ContentWorkflow service in the cases described above.

To solve this problem, we should implement a doctrine flush subscriber that listens to transition events and emits a new workflow event after the changes are flushed to the database (not sure about the naming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXOnly affecting the end developer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions