Replies: 1 comment
-
|
I am struggling with the exact same problem for weeks now. I've summarized some of my research here, if you want to take a look: For inputs, we don't have a satisfying result right now. For Outputs, we've end up to use a mix of serializer groups, with custom source/target attributes if needed. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Supose I have two Entity classes:
And also I have two DTO classes:
#[ApiResource( operations: [ new Get(), new GetCollection(), ], stateOptions: new Options(entityClass: BookEntity::class) )] class BookApi { public int $id; public string $title; public AuthorApi $author; } #[ApiResource( operations: [ new Get(), new GetCollection(), ], stateOptions: new Options(entityClass: AuthorEntity::class) )] class AuthorApi { public int $id; public string $name; /** * array<BookApi> */ public array $books; }$authoras AuthorApi object (in BookApi) and$booksas collection (array) of BookApi objects (in AuthorApi)?$booksfield as collection of BookApi, but should be fetch BookEntity objects behind the scene?I don't want mix up entities with DTO classes, for example:
I tried to use "symfony/object-mapper" but no chance so far.
Thanks for Your help.
Beta Was this translation helpful? Give feedback.
All reactions