Skip to content

SelectFields will only fire relationship query once and therefore with wrong arguments #604

Description

@crissi

I was looking into this #602 and fell over this bug.

With this query:

query ($proId: Int, $proId2: Int) {
  test2 {
    name

    alias1: profile(profileId: $proId2) {
      contentType
    }
    
    alias2:profile(profileId: $proId) {
      contentType
    }

  }
}
{
  "proId": 2,
  "proId2": 4,
  "id": 70
}

image

The profile relationship is only run once and therefore the different arguments given to the custom query clause is not taken into account, only the last query get the right args.

It seems a bit to hard to fix since it is not easily possible to alias eloquent relationships.

Unfortunately something like this is not possible. This would have made it a simplier fix
User::with('relationship', 'relationship AS other')->get();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions