This repository has been archived by the owner on Jul 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 205
LocalKey not working with a HAS_ONE relationship #204
Comments
Also came across this feature. Please add the "localKey" for relations HAS_ONE, HAS_MANY and BELONGS_TO. For those looking for a quick solution - make like issue author: (start at line 313 in Ardent.php) |
What would need to be done to get this included in a release? |
Has this been included in a release? |
this might be something that was added later and not looked into at the time of development. Just wondering: is your field was |
igorsantos07
added a commit
that referenced
this issue
May 9, 2015
localKey argument for relationships is now considered. closes #204
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I had the following database scheme:
users
languages
Now I have tried to make the relationship between language_id and languages.id:

But after an hour debugging I found out that he didn't used the localKey but just the primary key of the table, in the case of the user table it's 'id'. So I took a look in the source of Ardent and saw that the localKey parameter isn't sent to Model@hasOne while it is an (optional) parameter of the hasOne method of Laravel. Is this a bug? Because when I changed rule 316&317 in Ardent.php it worked:

Thanks in advance
The text was updated successfully, but these errors were encountered: