Skip to content
Discussion options

You must be logged in to vote

Gave it a try, see arthurGrinjo/PostRelation#1

The loop comes from the DTOs: an IRI resolves to what your API exposes, and your User operations expose UserResponseDto, so that's what getResourceFromIri() returns. You'll never get the entity from an IRI when using stateOptions, and it's by design.

Instead, drop the DTOs and make the classes carrying the operations your resources (no #[ApiResource], one class per shape):

#[Get(uriTemplate: 'users/{uuid}', shortName: 'user', stateOptions: new Options(entityClass: UserEntity::class))]
#[Map(target: UserEntity::class, transform: UserResourceToEntity::class)]
#[Map(source: UserEntity::class)]
final class User
{
    #[ApiProperty(identifier: true)…

Replies: 7 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@arthurGrinjo
Comment options

Comment options

You must be logged in to vote
2 replies
@arthurGrinjo
Comment options

@soyuka
Comment options

Answer selected by arthurGrinjo
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants