From a3b6974249350c77d703e6f589a46caa86f5c9ec Mon Sep 17 00:00:00 2001 From: Vladimir Razuvaev Date: Sun, 20 Aug 2017 22:59:40 +0700 Subject: [PATCH] Added entry in docs about schema config class --- docs/type-system/schema.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/type-system/schema.md b/docs/type-system/schema.md index 5bcff15..08ee12f 100644 --- a/docs/type-system/schema.md +++ b/docs/type-system/schema.md @@ -91,6 +91,23 @@ directives | `Directive[]` | A full list of [directives](directives.md) support types | `ObjectType[]` | List of object types which cannot be detected by **graphql-php** during static schema analysis.

Most often it happens when the object type is never referenced in fields directly but is still a part of a schema because it implements an interface which resolves to this object type in its **resolveType** callable.

Note that you are not required to pass all of your types here - it is simply a workaround for concrete use-case. typeLoader | `callable` | **function($name)** Expected to return type instance given the name. Must always return the same instance if called multiple times. See section below on lazy type loading. +# Using config class +If you prefer fluid interface for config with auto-completion in IDE and static time validation, +use [`GraphQL\Type\SchemaConfig`](../reference.md#graphqltypeschemaconfig) instead of an array: + +```php +setQuery($myQueryType) + ->setTypeLoader($myTypeLoader); + +$schema = new Schema($config); +``` + + # Lazy loading of types By default, the schema will scan all of your type, field and argument definitions to serve GraphQL queries. It may cause performance overhead when there are many types in the schema.