docs(operations): throwOnNotFound + dynamic status by soyuka · Pull Request #2327 · api-platform/docs · GitHub
Skip to content

docs(operations): throwOnNotFound + dynamic status - #2327

Merged
soyuka merged 1 commit into
api-platform:4.4from
soyuka:docs/operations-4.4-options
Sep 13, 2026
Merged

soyuka merged 1 commit into
api-platform:4.4from
soyuka:docs/operations-4.4-options

Conversation

@soyuka

@soyuka soyuka commented Sep 12, 2026

Copy link
Copy Markdown
Member

Summary

Documents two 4.4 operation-level features that shipped without any docs (audit rows F20/F23):

  • throwOnNotFound (feat(metadata): throwOnNotFound option core#6027) — controls whether the ReadProvider throws a 404 Not Found when the provider returns null. Verified the actual default logic in src/State/Provider/ReadProvider.php:91-103 (upstream/4.4): by default a 404 is thrown unless the method is POST, or the operation is a PUT with allowCreate enabled. Cross-referenced with the existing "Upsert: Creating a Resource With PUT" section rather than restating allowCreate.
  • Dynamic response status via the _api_response_status request attribute (feat: support dynamic HTTP response status code via request attribute core#7904) — read in src/State/Util/HttpResponseStatusTrait.php:40-41, consumed by RespondProcessor. It takes precedence over the operation's static status option. Documented as the escape hatch for a status that depends on runtime processor logic, with a worked custom-processor example, and an explicit note that the static status option remains the right tool for a fixed-per-operation code.

Both features exist as-is in 4.4 and flow to 5.0 via merge-up; written in plain present tense with an "Available since API Platform 4.4." note, matching the convention already used in core/performance.md.

Scope

Only core/operations.md touched. No new page, so outline.yaml is unchanged.

Test plan

  • Verified throwOnNotFound default logic by reading ReadProvider::provide() at upstream/4.4
  • Verified _api_response_status attribute name and precedence by reading HttpResponseStatusTrait::getStatus() and RespondProcessor::process() at upstream/4.4
  • npx prettier@3.9.5 --check "**/*.md" --prose-wrap always passes repo-wide

Document two 4.4 operation-level features that shipped without docs:

- `throwOnNotFound` (core#6027): controls whether ReadProvider throws
  404 on null data, cross-referenced with `allowCreate` on PUT.
- dynamic response status via the `_api_response_status` request
  attribute (core#7904), read by HttpResponseStatusTrait ahead of the
  static `status` operation option.

Verified against api-platform/core src/State/Provider/ReadProvider.php
and src/State/Util/HttpResponseStatusTrait.php at upstream/4.4.
@soyuka
soyuka merged commit 4e571e4 into api-platform:4.4 Sep 13, 2026
3 checks passed
@soyuka
soyuka deleted the docs/operations-4.4-options branch September 13, 2026 06:21
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