Skip to content

docs(config): clarify default-order vs operation-order precedence#2288

Merged
soyuka merged 1 commit into
api-platform:4.3from
soyuka:docs/default-order-precedence
Jun 6, 2026
Merged

docs(config): clarify default-order vs operation-order precedence#2288
soyuka merged 1 commit into
api-platform:4.3from
soyuka:docs/default-order-precedence

Conversation

@soyuka
Copy link
Copy Markdown
Member

@soyuka soyuka commented Jun 5, 2026

Summary

api_platform.defaults.order is described as "default" but actually prepends its keys to any operation-level order via array_merge($globalDefault, $operationOrder). It is not a fallback — it always applies. This caused confusion in api-platform/core#8156 where a user expected the operation-level order to fully replace the default.

This is intentional (cross-cutting invariants like createdAt DESC), but the existing docs incorrectly stated that operation-level order "overrides" the global default.

This PR:

  • Corrects the inaccurate "overrides" claim in the existing paragraph.
  • Adds a new "Global Default Order and Operation Order Precedence" section that explains the merge-prepend semantics, shows a concrete YAML + PHP example with the resulting ORDER BY, and documents the escape hatch (omit the global default and set order per-operation, or replace OrderExtension).

Refs api-platform/core#8156.

Test plan

  • Render locally — section appears under existing per-operation default-order example.
  • Reviewer confirms tone/placement.

@soyuka soyuka changed the base branch from 4.2 to 4.3 June 6, 2026 06:06
`api_platform.defaults.order` prepends its keys to any operation-level
`order` (via `array_merge($globalDefault, $operationOrder)`) rather than
acting as a fallback that yields to the operation. Correct the inaccurate
"overrides" claim in the existing paragraph and add a new section that
explains the merge semantics, shows a concrete example with resulting
ORDER BY, and documents the escape hatch (omit the global default and set
order per-operation, or replace OrderExtension).

Refs api-platform/core#8156 (documents intentional behaviour).
@soyuka soyuka force-pushed the docs/default-order-precedence branch from eddfe62 to ca02e93 Compare June 6, 2026 06:28
@soyuka soyuka merged commit c1081e1 into api-platform:4.3 Jun 6, 2026
3 checks passed
@soyuka soyuka deleted the docs/default-order-precedence branch June 6, 2026 06:31
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.

1 participant