Open ashtonlance opened 5 years ago
@ashtonlance can you verify that the variable being passed is an integer instead of a string? what exactly is being passed … also what are you trying to do?
@dstrunk Thanks for getting back to me. Basically I'm trying to add a category to a Categories relationship field on an entry type called Projects.
Per MutationTest.php
-- an object should be passed to the mutation
public function testMultiSelectMutation(): void
{
$input = 'mutation { story: upsertStories(title:"Multi Select Test'.date('U').'", socialLinksTwo:[fb, tw]) { id, socialLinksTwo } }';
$result = $this->execute($input);
$this->assertEquals('["fb","tw"]', json_encode(@$result['data']['story']['socialLinksTwo']));
}
My code reads as:
mutation addProject($title: String!, $totalHours: Int!, $selectedCat: [CategoryCategoryInput]!)
{
upsertProjects(
title: $title
projectName: $title
totalHours: $totalHours
category: $selectedCat
) {
id
title
totalHours
}
}
With $selectedCat
being an object looking like this [{id: 48}]
-- 48 is the id of the category I want to assign to the entry.
@markhuot @dstrunk Any ideas here?
Fixed in #301
Thanks @ashtonlance, #301 saved my morning!
Been banging my head trying to figure this one out. Ended up running the test and it failed with the same error I was getting in IDE.
"error": "A non well formed numeric value encountered"
PHP 7.3 Craft CMS 3.1.32.1