Hello every one
I am using graphql and have some weird issue,
First some context about package version:
- api-platform/core: 2.5.7
- webonyx/graphql-php: 14.3.0
This is my models
`class Book {
/**
* @Orm\Id
* @Orm\Column(type="integer")
* @Orm\GeneratedValue(strategy="IDENTITY")
/
protected $id;
/*
* @Orm\Column(type="string")
/
protected $name;
/*
* @Orm\OneToMany(targetEntity="Comment", mappedBy="book", cascade={"all"}, orphanRemoval=true)
*/
protected $comments;
}
class Comment {
/**
* @Orm\Id
* @Orm\Column(type="integer")
* @Orm\GeneratedValue(strategy="IDENTITY")
/
protected $id;
/*
* @Orm\ManyToOne(targetEntity="Book", inversedBy="comments")
* @Orm\JoinColumn(name="book_id", referencedColumnName="id")
/
protected $book;
/*
* @Orm\ManyToOne(targetEntity="Customer")
* @Orm\JoinColumn(name="localizacion_id", referencedColumnName="id", onDelete="CASCADE")
/
protected $customer;
/*
* @Orm\Column(type="text")
*/
protected $comment;
}
class Customer {
/**
* @Orm\Id
* @Orm\Column(type="integer")
* @Orm\GeneratedValue(strategy="IDENTITY")
/
protected $id;
/*
* @Orm\Column(type="string")
*/
protected $name
}`
This is my graphql query:
{ books { edges { node { id _id name comments { edges { node { id _id customer { id name } } } } } } totalCount pageInfo { endCursor startCursor hasNextPage hasPreviousPage } } }
When a request from customer only id it work perfect and return proper IRI so the customer is not null at all, but when customer name is requested and exception is being raised with debug message: Cannot return null for non-nullable field "Customer.name"."
Any help will be welcome, thanks in advantage
Hello every one
I am using graphql and have some weird issue,
First some context about package version:
This is my models
`class Book {
/**
* @Orm\Id
* @Orm\Column(type="integer")
* @Orm\GeneratedValue(strategy="IDENTITY")
/
protected $id;
/*
* @Orm\Column(type="string")
/
protected $name;
/*
* @Orm\OneToMany(targetEntity="Comment", mappedBy="book", cascade={"all"}, orphanRemoval=true)
*/
protected $comments;
}
class Comment {
/**
* @Orm\Id
* @Orm\Column(type="integer")
* @Orm\GeneratedValue(strategy="IDENTITY")
/
protected $id;
/*
* @Orm\ManyToOne(targetEntity="Book", inversedBy="comments")
* @Orm\JoinColumn(name="book_id", referencedColumnName="id")
/
protected $book;
/*
* @Orm\ManyToOne(targetEntity="Customer")
* @Orm\JoinColumn(name="localizacion_id", referencedColumnName="id", onDelete="CASCADE")
/
protected $customer;
/*
* @Orm\Column(type="text")
*/
protected $comment;
}
class Customer {
/**
* @Orm\Id
* @Orm\Column(type="integer")
* @Orm\GeneratedValue(strategy="IDENTITY")
/
protected $id;
/*
* @Orm\Column(type="string")
*/
protected $name
}`
This is my graphql query:
{ books { edges { node { id _id name comments { edges { node { id _id customer { id name } } } } } } totalCount pageInfo { endCursor startCursor hasNextPage hasPreviousPage } } }When a request from customer only id it work perfect and return proper IRI so the customer is not null at all, but when customer name is requested and exception is being raised with debug message: Cannot return null for non-nullable field "Customer.name"."
Any help will be welcome, thanks in advantage