Search by

webmasterapp / graphql-frontend-api

webmasterapp

Usage of GraphQL on the Nette backend

Package info

gitlab.com/master-webteam/graphql-frontend-api

Issues

pkg:composer/webmasterapp/graphql-frontend-api

Statistics

Installs: 6 976

Dependents: 0

Suggesters: 0

Stars: 0

15.6.0 2026-11-17 12:57 UTC

This package is auto-updated.

Last update: 2026-11-17 12:00:05 UTC


README

graphqlfrontapi

Cache-only reads use the normal generated repository methods with SendGraphQLRequestParameters::$cacheOnly = true. They return the same typed result on a cache hit and throw GraphQLCacheMissException on a miss, expired entry, disabled cache, or forced fresh update. No API request is sent in this mode. The flag enables cache reading without requiring enableCacheRead; configured cache disabling still applies unless forceCacheEnable is explicitly set. Callers can catch the exception and defer the normal lookup to an asynchronous request.

Use GraphQLTestCommunicator in model tests to run generated repositories with mock data. Each fixture supplies the fields under data for one request. The communicator passes a synthetic response to the normal parser without sending HTTP requests. Calling mockResponses() replaces the queue and clears the query history.

$communicator = new \GraphQLFrontApi\Testing\GraphQLTestCommunicator();
$communicator->mockResponses(['serviceCloudMDCOfferList' => []]);

// Pass $communicator to the generated repository and run the code under test.
$queries = $communicator->queries();