Hello,
I am trying nested mutation for three levels of depth in the relationship.
The flow is:
user has one to one relationship with lead
lead has many to many relationship with task
when i try to create user with lead, it works fine. but when i try to create task, it doesn't work. it puts 0 for newly created id to table agent_task which is pivot table for lead and task.
it's giving me this error.

Here is sample code
input CreateUserInput {
parent_id: Int!
firstname: String!
lastname: String
email: String
phone: String
notes: String
source: UserSource!
is_test: Boolean
lead: CreateLeadHasOne!
}
input CreateLeadInput {
abid: String
relation: LeadRelation
referral_name: String
first_touch_type: LeadFirstTouchType
tasks: CreateTaskBelongsToMany
}
input CreateLeadHasOne {
create: CreateLeadInput
}
input CreateTaskBelongsToMany {
connect: [CreateTaskInput]
}
input CreateTaskInput {
agent_id: Int!
task_id: Int!
started_at: DateTime
notes: String
}
And here is the mutation call
mutation
{
createUser(input: {
parent_id: 1
firstname: "last"
email: "[email protected]"
source: ADMIN
lead:
{
create: {
relation: FAMILY_FRIEND
tasks:
{
connect:
{
agent_id: 1
task_id: 1
}
}
}
}
})
{
id
}
}
Denote codeblocks with
```graphql
to ensure they are readable.
Denote codeblocks with
```graphqlto ensure they are readable.
done
Needs a PR with a failing test case in https://github.com/nuwave/lighthouse/blob/master/tests/Integration/Execution/MutationExecutor/BelongsToManyTest.php
Needs a PR with a failing test case in https://github.com/nuwave/lighthouse/blob/master/tests/Integration/Execution/MutationExecutor/BelongsToManyTest.php
in the reference link, type Role has defined pivot in it. but in my case, there are more than 5 pivot tables for same type Lead.
Needs a PR with a failing test case in https://github.com/nuwave/lighthouse/blob/master/tests/Integration/Execution/MutationExecutor/BelongsToManyTest.php
My issue is little different, i want to insert data in different tables in nested mutation. Like, first user creation, then add lead data of that user that is created. And then add entry in pivot table of agent_task, in which i want to put lead_id that is recently created. And then i want to add row to another table where i want to use the id of agent_task that is recently created.
so there are almost 4 nested relationships that depend on their parent created id. there may be more in future. Let me know if any confution
Needs a PR with a failing test case in https://github.com/nuwave/lighthouse/blob/master/tests/Integration/Execution/MutationExecutor/BelongsToManyTest.php
Let me know what else needed from my side, i will provide.
Let me know what else needed from my side, i will provide.
A PR is exactly what is needed and helps much more than any textual description of the issue. Try to find an equivalent case or add to the test setup as needed to reproduce your specific failure case.
Needs a PR with a failing test case in https://github.com/nuwave/lighthouse/blob/master/tests/Integration/Execution/MutationExecutor/BelongsToManyTest.php
there are only 3 tables and in this link only 2 level of nested mutation tests are there.
My issue is somewhat like this one.
https://stackoverflow.com/questions/57896248/how-to-create-mutation-with-3-or-more-nested-relationships
Needs a PR with a failing test case in https://github.com/nuwave/lighthouse/blob/master/tests/Integration/Execution/MutationExecutor/BelongsToManyTest.php
there are only 3 tables and in this link only 2 level of nested mutation tests are there.
My issue is somewhat like this one.
https://stackoverflow.com/questions/57896248/how-to-create-mutation-with-3-or-more-nested-relationships
@spawnia any luck? if you have confusion, ask me question, i will try to explain.
I need working test code, not explanations.
I need working test code, not explanations.
I have added the code in post. complete flow of graphql inputs. and also added screenshot of what error i am facing.
i have added mutation call structure as well. what else more i need to put???
I need working test code, not explanations.
code isn't working brother, therefore i created thread. nested mutation of 3rd level isn't working.
To be able to help you further it is much better and simpler, if you provide a failing test case via PR. This is what spawnia means by "working test code" - a test that fails. You are the one, who is facing the problem, so at the moment only you know, in what particular situation the problem occur.
Also, if this should really be a bug in lighthouse, you would help the project by providing at least a failing test case, so contributors are able to fix it
Thanks @lorado
@subhankhalid402 https://github.com/nuwave/lighthouse/blob/master/CONTRIBUTING.md#the-process describes how you can create a PR. In order for us to recognize, debug and fix the issue we need to have a test case that triggers it as a part of this project.