API Platform version(s) affected: 3.1.18
Description
I'm trying to use the ApiProperty attribute to secure a field present in an nested object of the object I'm querying.
But the property seems to have no effect when I use it on a field of the parent object, it works perfectly!
How to reproduce
Project.php
#[ORM\JoinColumn(nullable: false)]
#[Groups(['read:Project'])]
private ?User $owner = null;
#[ORM\Column]
#[Groups(['read:Project'])]
#[ApiProperty(security: 'is_granted("ROLE_ADMIN")')]
private ?int $size = null;
#[ORM\Column]
#[Groups(['read:Project'])]
private ?string $label = null;
User.php (abstract class)
#[Groups(['read:Project'])]
#[ApiProperty(security: 'is_granted("ROLE_ADMIN")')]
private ?string $email = null;
#[ORM\Column(length: 180, unique: true)]
#[Groups(['read:Project'])]
private ?string $name = null;
Response
label: 'Test',
owner: {
email: 'test@test.com',
name: 'Test Test'
}
API Platform version(s) affected: 3.1.18
Description
I'm trying to use the
ApiPropertyattribute to secure a field present in an nested object of the object I'm querying.But the property seems to have no effect when I use it on a field of the parent object, it works perfectly!
How to reproduce
Project.php
User.php (abstract class)
Response