docs(config): clarify default-order vs operation-order precedence#2288
Merged
Conversation
`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).
eddfe62 to
ca02e93
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
api_platform.defaults.orderis described as "default" but actually prepends its keys to any operation-levelorderviaarray_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-levelorder"overrides" the global default.This PR:
ORDER BY, and documents the escape hatch (omit the global default and set order per-operation, or replaceOrderExtension).Refs api-platform/core#8156.
Test plan