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.