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

relatedTo along with orRelatedTo #144

Open
woro83c opened this issue Aug 25, 2018 · 7 comments
Open

relatedTo along with orRelatedTo #144

woro83c opened this issue Aug 25, 2018 · 7 comments

Comments

@woro83c
Copy link
Contributor

woro83c commented Aug 25, 2018

Heya. I'm needing to combine the functionality of both relatedTo and orRelatedTo, e.g.:

{
  entriesConnection(section: profile, relatedTo: [{ element: 1 }, { element: 2 }, [{ element: 3 }, { element: 4 }]]) {
    totalCount
    entries {
      ... on Profile {
        title
      }
    }
  }
}

So basically I want all profiles that are related to entries 1 and 2 and (3 or 4). How would I go about doing this? Thanks!

woro83c added a commit to woro83c/craftql that referenced this issue Aug 26, 2018
markhuot added a commit that referenced this issue Sep 7, 2018
@markhuot
Copy link
Owner

markhuot commented Sep 7, 2018

This is merged. I'll leave the ticket open until it gets a stable tag.

@BenParizek
Copy link

@markhuot @woro83c Is the above example supposed to be a working example? I've downloaded the latest release with these updates but am not having luck getting a similar query working.

@woro83c
Copy link
Contributor Author

woro83c commented Dec 14, 2018

hey @BenParizek - give something like this a try:

{
  entriesConnection(relatedTo: [{ element: 1 }, { element: 2 }, { element: [3, 4] }]) {
    ...
  }
}

@BenParizek
Copy link

Awesome @woro83c! That gets me rolling again.

@markhuot
Copy link
Owner

Closing this issue. The fix is included in version 1.2.1.

@BenParizek
Copy link

@markhuot It may be nice to add an example of multiple relationships like this to the docs. It may be obvious to some, but took me a longer than I'd like to admit to make the connection to the more complex syntax.

It's always helpful to have a simple example to get started with and prove things work and a complex example that helps see all the different patterns that we could consider using.

@markhuot
Copy link
Owner

I'll re-open until I get the docs updated. Good idea.

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

3 participants