-
-
Notifications
You must be signed in to change notification settings - Fork 933
Closed
Description
Sometime we need to write a long code like :
#[ApiResource(
routePrefix: '/live-chat',
normalizationContext: ['groups' => ['restful_read']],
denormalizationContext: ['groups' => ['restful_write']],
openapiContext: ['tags' => ['LiveChat']],
order: ['id' => 'DESC'],
security: 'is_granted("ROLE_OPERATOR")'
)]
It is too long for person to read.
Can we just create a new Attribute class, class RestfulApi extends ApiResource
, and move some normal logic into consturctor?
Then we just add code like this:
#[RestfulApi(
routePrefix: '/live-chat',
)]
Related code:
if ($reflectionClass->getAttributes(ApiResource::class)) { |
Cruiser13
Metadata
Metadata
Assignees
Labels
No labels