Skip to content
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

Allow non-ID foreign keys #120

Open
brummett opened this issue Jun 22, 2016 · 0 comments
Open

Allow non-ID foreign keys #120

brummett opened this issue Jun 22, 2016 · 0 comments

Comments

@brummett
Copy link
Contributor

Allow object accessors that link to a non-ID property for the remote object, and do the join in SQL if the data is in the DB. For example, return all the OtherObjects where their "their_name" property matches my "name" property.

Some possible syntaxes:

other_objects => {
    is => 'OtherObject',
    id_by => { name => \'their_name' },
}

or

other_objects => {
    is => 'OtherObject',
    where => { their_name => \'name' },
},

Before actually getting into the implementation, the latter is preferable. The accessor/mutator should follow the other indirect object mutators by automatically assigning the linking property if passed an OtherObject instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant