Descripción
Recursos =
- Documentación oficial: EN
Ejemplo
Ejemplo 1
#[ApiResource(
uriTemplate: '/answers/{id}/related_questions.{_format}',
uriVariables: [
'id' => new Link(fromClass: Answer::class, fromProperty: 'relatedQuestions')
],
operations: [new GetCollection()]
)]
Ejemplo 2
#[ApiResource(
uriTemplate: '/companies/{companyId}/employees/{id}',
uriVariables: [
'companyId' => new Link(fromClass: Company::class, toProperty: 'company'),
'id' => new Link(fromClass: Employee::class),
],
operations: [ new Get() ]
)]
Ejemplo 3
#[ApiResource(
uriTemplate: '/companies/{companyId}/employees',
uriVariables: [
'companyId' => new Link(fromClass: Company::class, toProperty: 'company'),
],
operations: [ new GetCollection() ]
)]