Tag: api-platform.com
-
ApiPlatform best way to convert to exist entity on mutation graphql
0 I have this entitys for user #[UniqueEntity(fields: [’email’], message: ’email is exists’)] #[ORMEntity] #[ORMTable(name: ‘user’)] #[ApiPlatformApiResource( operations: [], graphQlOperations: [ new ApiPlatformGraphQlQuery(), new ApiPlatformGraphQlMutation( name: ‘create’, denormalizationContext: [‘groups’ => [‘request:create’, ‘shopping:create’]], ), ] )] class User { #[ORMId] #[ORMGeneratedValue(strategy: ‘AUTO’)] #[ORMColumn(type: ‘integer’)] #[SerializerExpose] protected $id; #[AssertEmail(message: ’email not valid’)] #[ORMColumn(type: ‘string’, unique: true, length:…
-
Return custom collection in graphQL with Api Platform using custom data provider
0 I have a custom DTO class, and I want to return a collection of that using graphQL. With REST it works fine. I’m using Api Platform 2.6 and PHP 8.2 There is my DTO class : <?php declare(strict_types=1); namespace AppDto; use ApiPlatformCoreAnnotationApiProperty; use ApiPlatformCoreAnnotationApiResource; #[ApiResource( collectionOperations: [ ‘get’ => [ ‘method’ => ‘GET’, ‘path’…
-
Using api-platform to query with GraphQL, how can I create a filter from a virtual field?
0 Im using symfony 6 and api-platform/core: v3.1.3. Said that, I have an entity that has a method calculable/virtual that I would like to query using graphQL That is the entity <?php #[ ApiResource( operations: [ new Get(), new Put( denormalizationContext: [‘groups’ => [‘update’]], ), new Delete(), new GetCollection(), new Post(), ], normalizationContext: [‘groups’ =>…
-
How to embed nullable relations in ApiPlatform using GraphQL
0 I am creating an API with ApiPlatform v3.2.1 and make use of the GraphQL features to query the API. How can I make it possible to use nullable embedded relations? For example I have an entity "Ordering" and nullable one-to-one related entities "ProductFoo" and "ProductBar". "ProductFoo" and "ProductBar" relation to "Ordering" is not nullable…
-
Export GraphQL result to CSV without pagination
0 We have multiple lists that contain filters and are requested with GraphQL. We want to export the results to a CSV. At the moment we created a controller that loops over the paginator by requesting the GraphQL endpoint and concats the result to one array. Is there a native way to do it internally…
-
Custom filters doesn’t apply for GraphQL collection query in API Platform
0 I’m using API Platform and I want to add graphQL support and keep the same behavior between my REST calls and my graphQL calls. I have some custom filters for my get collection that works fine with REST, but they are not recognized in graphQL. According to the doc, I’ve added the following so…
-
GraphQL Mutation Error in doctrine OneToOne nested relation with API Platform
1 I am currently facing an issue with a GraphQL mutation in API Platform and was hoping to find some help here. Here is the background: I am working with two entities, Recepe and Picture, which have a OneToOne relationship. In my Recepe entity, the mainPicture field is linked to the Picture entity. Below are…
-
API Platform – GraphQL Schema mapping nullable Collection
0 I’m pretty new to GraphQL, I’m building an API and a React App that connects to it. I need some help defining my GraphQL schema, I can’t find out what I’m doing wrong, but my GraphQL schema keeps bringing a mapped Collection as nullable… I’ve been following the official docs (https://api-platform.com/docs/core/graphql/) but can’t find…
-
how to use graphiql when route are secured?
4 i have an application based on api-platform with secured route using JWT (and the LexikJWTBundle). With the Swagger interface it’s easy to call secured route providing a valid bearer. But with GraphiQL i don’t see anything about security so when a call a secured route it fails. Any idea ? or shall we prevent…
-
API Platform custom GraphQL output
0 I’m working on a GraphQL API using API Platform 2.7 and PHP8. I’m stuck since yersterday on a basic simple thing which is very annoying >< I want to create a custom Query which does not return my ApiRessource class (User) but another representation (MyFullPerimeterOutput). When I do it in REST API it works…