Category: graphql

OneToMany relation when using custom identifier in GraphQL returns null/wrong data

I am using api-platform with Symfony 5 to build GraphQl API. When using custom identifier that is not a primary key, OneToMany result set returns null or wrong data. This issue is caused because when fetching data from OneToMany table,…

Create nested doctine objects with one GraphQl query with API Platform

I have a basic Entity in my symfony application: /** * @ApiResource() * @ORMEntity(repositoryClass=CardRepository::class) */ class Card { /** * @ORMId() * @ORMGeneratedValue() * @ORMColumn(type=”integer”) */ private $id; /** * @ORMOneToMany(targetEntity=CardReference::class, mappedBy=”card”, orphanRemoval=true) */ private $cardReferences; /** * @ORMColumn(type=”string”, length=255,…

Symfony API Platform very slow with MYQSL as persistance layer [closed]

This is moreover a generic/ architectural stuff.So let me explain the scenario. We are using Symfony API platform as our backend for REST API’s and our Front end is React. The api’s are becoming slow day by day. Our mysql…

How to set cookies for response in GraphQL mutation in Symfony 5?

How to set cookies for response in GraphQL resolver in Symfony 5? I am generating JWT token in mutation resolver and I want to set this token to Http cookie. // LoginMutator.php namespace AppGraphQLMutatorsSecurity; … class LoginMutator implements MutationInterface {…

Cannot return null for non-nullable field on API platform and graphql

I have an “user” entity with an unmapped property like this : namespace AppEntityUser; // … /** * @var string * @Groups({“readAnnounce”, “readUser”}) */ private $lastUrlImageProfilValid; /** * @return string */ public function getLastUrlImageProfilValid() { foreach ($this->imageProfil as $image){ if…