API Platform: Add support for resource attributes, filters and operation targets#346
Draft
API Platform: Add support for resource attributes, filters and operation targets#346
Conversation
…ion targets Resolves #344. Resource classes (classes carrying #[ApiResource] or any HTTP/GraphQL operation attribute) now have their constructor, non-static properties (READ+WRITE) and PropertyAccessor-style methods marked as used because API Platform instantiates and (de)serializes them at runtime. Also resolves provider/processor/controller class-string references in operation attributes and filter classes referenced via #[ApiFilter]. Co-Authored-By: Claude Code
|
Thanks for taking this. On the attributes there's an input and output property as well which can take a class-string argument, or (this is from memory, can't check right now) it takes an array with a 'class' key and class-string value. Just fyi, because I did see specific mentioning of controller, processor and provider but not input and output. |
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
ApiPlatformUsageProvidermarks__construct, non-static properties (READ+WRITE) and PropertyAccessor-style methods as used on classes carrying#[ApiResource]or any HTTP/GraphQL operation attribute — because API Platform instantiates and (de)serializes them at runtimeprovider:/processor:/controller:class-string references in operation attributes (includingClass::methodcallable syntax) and filter classes referenced via#[ApiFilter](class- and property-level)api-platform/core,api-platform/metadata,api-platform/state, orapi-platform/symfonyis installed; opt-in/opt-out viashipmonkDeadCode.usageProviders.apiPlatform.enabledResolves #344.
Scope notes
Phase 1 — only flat-style operation attributes on the class (e.g.
#[Get(provider: X::class)]) are scanned. The nested form#[ApiResource(operations: [new Get(provider: X::class)])]is not yet covered and can be added in a follow-up.Co-Authored-By: Claude Code