Skip to content

[5.x]: Field-specific relational filter behaves like a generic relatedTo #18643

@plcdnl

Description

@plcdnl

What happened?

Description

The placeOfDeath argument on the entries query does not filter correctly by that specific relational field. Instead, it appears to behave like a generic relatedTo filter, returning entries where the given ID is related to the entry in any relational field — not exclusively placeOfDeath.

Steps to reproduce

  1. Open the GraphQL API explorer (Full Schema)
  2. Run the following query:
query {
  entries(section: "person", placeOfDeath: [183450]) {
    id
    title
    ... on personDefault_Entry {
      placeOfBirth {
        id
        title
      }
      placeOfDeath {
        id
        title
      }
    }
  }
}
  1. Observe that the returned entry has placeOfBirth.id = "183450" but placeOfDeath.id = "156580"

Expected behavior

Only entries where placeOfDeath contains ID 183450 should be returned. An entry where 183450 appears only in placeOfBirth should not be included in the results.

Actual behavior

The returned entry has ID 183450 in placeOfBirth, not in placeOfDeath:

{
  "data": {
    "entries": [
      {
        "id": "157678",
        "title": "Chiha, Michel",
        "placeOfBirth": [
          { "id": "183450", "title": "Ottoman Syria" }
        ],
        "placeOfDeath": [
          { "id": "156580", "title": "Beirut" }
        ]
      }
    ]
  }
}

The filter is matching the ID across all relational fields instead of scoping the lookup to placeOfDeath only.

Image

Craft CMS version

5.9.17

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions