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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested relationship search is broken in 2.0.0 #31

Closed
odinns opened this issue Jun 22, 2021 · 5 comments
Closed

Nested relationship search is broken in 2.0.0 #31

odinns opened this issue Jun 22, 2021 · 5 comments

Comments

@odinns
Copy link

odinns commented Jun 22, 2021

Nice package! 馃槉

Trying out your package, I found that nested relationship search is broken in 2.0.0, as it returns Call to undefined relationship [user.country] now.

Works in 1.0.6 though.

@chancezeus
Copy link

Confirmed, the "ensureRelationshipExists" method in "RelationSearch" does not take into account nested relations

@chancezeus
Copy link

Tried a "quick fix", if you replace the current content (I run php8 so some changes might be required) with the following:

        if (!str_contains($relation, '.')) {
            $query->getRelation($relation);
        }

        $parts = explode('.', $relation);
        $rel = $query;
        while(!empty($parts)) {
            $rel = $rel->getRelation(array_shift($parts));
        }

Then it will be able to resolve the nested relations

@brandonb927
Copy link

We just upgraded to v2.0 recently and got bit by this issue :(

@TitasGailius
Copy link
Owner

Fixed in https://github.com/TitasGailius/nova-search-relations/tree/2.0.1

@brandonb927
Copy link

Thank you @TitasGailius!

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 a pull request may close this issue.

4 participants