You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
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