Class property of the ApiResource annotation doesn't propagate to operations
API Platform version(s) affected: 4.1.12
Symfony version: 6.4
Description
Configuring the class property on an #[ApiResource] does not propagate to the class at the operation level.
How to reproduce The following doesn't work:
#[ApiResource(
class: TestEntity::class,
)]
class TestEntityApiResource
{
}
If I configure it like this, it does work:
#[ApiResource(
operations: [
new Post(class: TestEntity::class),
new Get(class: TestEntity::class),
new GetCollection(class: TestEntity::class),
new Patch(class: TestEntity::class),
new Delete(class: TestEntity::class),
]
)]
class TestEntityApiResource
{
}
Possible Solution
Use the class property of the resource, override it if set on the operation.
you shouldn't really change the class but indeed we should fix this
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Sill an issue
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.