Repository navigation
What is the right way to specify operations? #5420
|
Hi, in the docs it tells me to do something like this: #[ApiResource(
operations: [
new Get(),
new GetCollection()
]
)]But when I look into the demo API it looks like this: #[GetCollection]
#[Post]
#[Get]
#[Put]
#[Patch]
#[Delete]
#[Put(
uriTemplate: '/books/{id}/generate-cover.{_format}',
normalizationContext: ['groups' => ['book:read', 'book:cover']],
output: false,
messenger: true,
)]So what is the right way? |
Answered by
alanpoulain
Feb 27, 2023
Replies: 3 comments
|
You can use both, but the core team prefers the first one (personally I prefer the second one 🙂). |
0 replies
Answer selected by
renja-g
|
Ahh ok, Thanks |
0 replies
|
We recommend the first one, as the one with attributes under each another was introduced for backward compatibility reasons, especially that at first attributes did not support instantiating classes inside the attribute and calling |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use both, but the core team prefers the first one (personally I prefer the second one 🙂).