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

GraphQL QueryArgument ":notempty:" not working for many-to-many field #42

Open
denisyilmaz opened this issue Oct 27, 2023 · 1 comment

Comments

@denisyilmaz
Copy link

denisyilmaz commented Oct 27, 2023

Describe the bug

We have two sections: Organisation Entries and Job Entries. Each Job Entry has a "organisation" relationship field that selects one organisation. In the organisation entry itself we added a many-to-many relationship field called "relatedJobs".

There is no way to filter the organisation entries to only show organisations where the relatedJobs is not empty.
Testing this with the built-in relationship field on the job entries this is working without an issue.

Steps to reproduce

  1. create two section types
  2. add on relationship field and one many-to-many relationship field on the entries
  3. query for both with queryargument ":notempty:"
query GetOrganisationsWithJobOffers {
  organisationsEntries(relatedJobs: ":notempty:") {
    ... on EntryInterface {
      title
    }
    ... on organisations_organisation_Entry {
      relatedJobs {
        title
      }
    }
  }
  allOrgEntries: organisationsEntries {
    ... on EntryInterface {
      title
    }
    ... on organisations_organisation_Entry {
      relatedJobs {
        title
      }
    }
  }
  jobsEntries(organisation: ":notempty:") {
    ... on jobs_jobOffer_Entry {
      title
      organisation {
        title
      }
    }
  }
}

Result:

{
  "data": {
    "organisationsEntries": [],
    "allOrgEntries": [
      {
        "title": "Some Organisation",
        "relatedJobs": [
          {
            "title": "Some Job Offer"
          }
        ]
      },
      {
        "title": "Some Other Organisation",
        "relatedJobs": []
      }
    ],
    "jobsEntries": [
      {
        "title": "Some Job Offer",
        "organisation": [
          {
            "title": "Some Organisation"
          }
        ]
      }
    ]
  }
}

Craft CMS version

4.5.6.1

Plugin version

3.0.4

Multi-site?

No

Additional context

No response

@engram-design
Copy link
Member

Still looking into this, I'm not sure why, but the arguments aren't even being picked up for the field! But this may very well be related to craftcms/cms#3538

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

2 participants