-
-
Notifications
You must be signed in to change notification settings - Fork 868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: search on nested sub-entity that doesn't use "id" as its ORM id #5623
Conversation
Just noticed #5618 - not much work to merge as far as i see, but both PRs share a goal to be able to use identifiers that are not always "int $id". |
c565126
to
188cef4
Compare
/** | ||
* @var DummyWithSubEntity $entity | ||
*/ | ||
$entity = $this->itemProvider->provide($operation, $uriVariables, $context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still want to check why this is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a simple explanation is that entityClass gives us the link from the ApiResource to the entity, but nothing really tells us how to convert an entity to a resource, so when the framework gets a subentity it doesn't have a way to know which resource it's supposed to convert it to if you don't do it explicitly in a custom provider.
Thanks @mrossard ! |
… ORM identifier (api-platform#5623)" This reverts commit b8cbdb1.
… ORM identifier (api-platform#5623)" (api-platform#5744) This reverts commit b8cbdb1.
This should fix that use case when ids are not composite.
Composite IDs would still need to be addressed with a custom filter, but that's even more of a fringe case...and would require quite of lot of work as far as i can see. I still left todo comments in case someone wants to tackle that.