Open AlexandreBonaventure opened 1 month ago
Hi @AlexandreBonaventure, Yeah, composite keys are only supported with many-to-many relationships at the moment. I'll look into it.
Your workaround doesn't work with all types of composite keys, but you should definitely use for your app (if you aren't already):
app/Relations/HasOneJson.php
) that extends the package's HasOneJson
.buildDictionaryWithCompositeKey()
with your adjusted version.Media
model, override newHasOneJson()
and return an instance of your own HasOneJson
class.I'll continue looking for a generic solution.
Hello! I have been using your library to help with some json relationships and I found myself needing to build some relationships with composite keys. The problem I'm facing is that if I define the relationship like that:
and eager-load it like that:
I get an error:
Because it seems like it is expecting the json key to be iterable. In the screenshot above, I tried a quick workaround that seems to work. Do you foresee problems with that ? Let me know if you want me to go ahead with a PR or not. Thanks!