diff --git a/docs/en/02_Developer_Guides/19_GraphQL/07_tips_and_tricks.md b/docs/en/02_Developer_Guides/19_GraphQL/07_tips_and_tricks.md index 2f3d249cd..ef11b24dc 100644 --- a/docs/en/02_Developer_Guides/19_GraphQL/07_tips_and_tricks.md +++ b/docs/en/02_Developer_Guides/19_GraphQL/07_tips_and_tricks.md @@ -17,16 +17,6 @@ Docs for the current stable version (3.x) can be found Often times, you'll need to know the name of the type given a class name. There's a bit of context to this. -### Getting the type name at build time - -If you need to know the name of the type _during the build_, e.g. creating the name of an operation, field, query, etc, -you should use the `Build::requireActiveBuild()` accessor. This will get you the schema that is currently being built, -and throw if no build is active. A more tolerant method is `getActiveBuild()` which will return null if no schema -is being built. - -```php -Build::requireActiveBuild()->findOrMakeModel($className)->getName(); -``` ### Getting the type name from within your app @@ -34,20 +24,7 @@ If you need the type name during normal execution of your app, e.g. to display i on the cached typenames, which are persisted alongside your generated schema code. ```php -Schema::create('default')->getTypeNameForClass($className); -``` - -### Why is there a difference? - -It is expensive to load all of the schema config. The `getTypeNameForClass` function avoids the need to -load the config, and reads directly from the cache. To be clear, the following is functionally equivalent, -but slow: - -```php -Schema::create('default') - ->loadFromConfig() - ->findOrMakeModel($className) - ->getName(); +SchemaFactory::get('default')->getTypeNameForClass($className); ``` ## Persisting queries