Skip to content

[Workflow] Add WorkflowFilter to scope element grids by workflow place#1938

Open
xIrusux wants to merge 3 commits into
2026.2from
workflow-state-drilldown
Open

[Workflow] Add WorkflowFilter to scope element grids by workflow place#1938
xIrusux wants to merge 3 commits into
2026.2from
workflow-state-drilldown

Conversation

@xIrusux

@xIrusux xIrusux commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What

Adds a workflow search-index filter so the native Studio element grid can be restricted to the elements in a given workflow place. This is the backend half of the state-distribution donut drill-down → native grid feature (frontend: pimcore/studio-dashboards-bundle workflow-state-drilldown).

How

WorkflowFilter (tagged pimcore.studio_backend.search_index.filter, modeled on MarkFilter/MultipleIdFilter):

  • Reads columnFilters of type workflow (key = workflow name, value = place; no place = all states, for the widget's show-all action).
  • Resolves matching element ids via WorkflowElementsRepositoryInterface::fetchByWorkflowState(...) and applies the existing searchByIds().
  • Element type derived from the query (DataObjectQueryInterface / AssetQueryInterface / DocumentQueryInterface).
  • Skips non-positive cids (orphaned element_workflow_state rows, e.g. cid=0) — the search index's IdsFilter requires strictly positive ids.
  • MAX_IDS ceiling guards the OpenSearch terms limit (logged, not user-facing). Permissions are enforced by the native grid query downstream (not duplicated here).

@internal, final readonly, DI against interfaces, no Pimcore statics — follows pimcore-studio-backend-architecture.

Tests

WorkflowFilterTest (Codeception unit): per-place resolution, all-places (null), asset element type, empty-set, and the orphaned-cid=0 regression. Verified php -l; Codeception runs in CI.

Notes

  • Base is 2025.4 per request (runs in the current dev env). Happy to retarget to 2026.x if this should land as a feature there first.

🤖 Generated with Claude Code

xIrusux and others added 2 commits July 6, 2026 09:01
* [Workflow] exclude folders from workflow element queries

Folders share their element's ctype (asset/object/document) in
element_workflow_state, so fetchByWorkflowState listed asset folders
alongside real assets in the workflow pending-items widget and the
workflow_get_elements click-through list (pimcore/studio-dashboards-bundle#301).

Filter out folder subtypes in SQL via the already-present assets/objects/
documents joins. The IS NULL guard per table is required: a plain
"type != 'folder'" would drop every non-matching LEFT JOIN row (NULL type)
through three-valued logic, emptying the result. Orphaned states (element
deleted) are preserved unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Address static-analysis finding: drop unused leftJoin callback params

Verify the join count via expects(exactly(3)) instead of a capturing
callback with unused $fromAlias/$join parameters (Codacy/PHPMD
UnusedFormalParameter).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
New search-index filter (type `workflow`, key=workflow name, value=place) that
resolves the matching element ids via WorkflowElementsRepository (folders already
excluded) and applies the standard searchByIds modifier. Lets the native element
listing be filtered to a workflow state server-side — the basis for the state
distribution donut drill-down opening the native grid instead of a bespoke list.

Element type is derived from the query (data-object / asset / document). Empty id
set matches nothing; a MAX_IDS ceiling guards the OpenSearch terms limit (logged).
Registered with the pimcore.studio_backend.search_index.filter tag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 12 minor

Results:
12 new issues

Category Results
BestPractice 1 minor
CodeStyle 11 minor

View in Codacy

🟢 Metrics 24 complexity

Metric Results
Complexity 24

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@xIrusux xIrusux requested a review from martineiber July 6, 2026 12:04
@xIrusux xIrusux self-assigned this Jul 6, 2026
@xIrusux xIrusux added this to the 2025.4.7 milestone Jul 6, 2026
Add the `workflow` column filter to the Grid architecture docs (filters
table + example): key = workflow name, value = place (omit/null = all
states), folders excluded, ids resolved server-side.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jul 6, 2026

Copy link
Copy Markdown

@xIrusux xIrusux changed the base branch from 2025.4 to 2026.2 July 6, 2026 13:27
@xIrusux xIrusux modified the milestones: 2025.4.7, 2026.2.1 Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants