DOCS: Remove BuildState documentation

This commit is contained in:
Aaron Carlino 2021-01-20 00:09:08 +13:00
parent f0ae5e96df
commit caa224e37b

View File

@ -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. 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 ### 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. on the cached typenames, which are persisted alongside your generated schema code.
```php ```php
Schema::create('default')->getTypeNameForClass($className); SchemaFactory::get('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();
``` ```
## Persisting queries ## Persisting queries