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

[7.x] Fix issue where HasMany relationship wasn't being resolved #630

Merged
merged 3 commits into from
Nov 4, 2024

Conversation

duncanmcclean
Copy link
Member

@duncanmcclean duncanmcclean commented Nov 4, 2024

This pull request fixes an issue where HasMany relationships weren't being resolved if the field handle differed from the relationship_name.

For example:

-
  handle: shipping_addresses
  field:
    resource: organization_shipping_address
    relationship_name: shippingAddresses
    type: has_many
    display: 'Shipping addresses'
    sortable: false

Even though the field handle was the "same" as the relationship name, but slugified, doing $model->shipping_addresses wouldn't work.

This PR fixes it by getting the correct relationship name, and calling that attribute instead.

Fixes #624.

@duncanmcclean duncanmcclean merged commit 7325648 into 7.x Nov 4, 2024
12 checks passed
@duncanmcclean duncanmcclean deleted the fix/has-many-relationship-not-being-resolved branch November 4, 2024 12:48
Copy link

github-actions bot commented Nov 4, 2024

Released as part of v7.12.0.

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

Successfully merging this pull request may close these issues.

Has many relationship does not load existing values
1 participant