class BuilderOfType implements CompoundType, LateResolvableType

The builder a model's newQuery() creates, written builder-of, or of a relation path's related model, written builder-of<TModel, 'path'>.

model-query-of and model-query-of<TModel, 'path'> are the builder newModelQuery() creates, which the unscoped queries, relationship existence queries and toQuery() run. It differs from newQuery()'s when the model overrides newQuery() with another builder.

Traits

LateResolvableTypeTrait

Methods

__construct(Type $type, BuilderHelper $builderHelper, Type|null $relationType = null, bool $modelQuery = false)

Create a builder-of type.

Type
getResult()

Resolve the builder type of each model the type stands for.

bool
isResolvable()

Determine whether the type can be resolved, which waits for its template types.

array
getReferencedClasses()

Get the classes the type refers to.

array
getReferencedTemplateTypes(TemplateTypeVariance $positionVariance)

Get the template types the type refers to.

bool
equals(Type $type)

Determine whether the type equals another.

string
describe(VerbosityLevel $level)

Describe the type.

Type
traverse(callable $cb)

Map the inner types.

Type
traverseSimultaneously(Type $right, callable $cb)

Map the inner types together with another builder-of type's.

TypeNode
toPhpDocNode()

Convert the type to a PHPDoc node.

Type
generalize(GeneralizePrecision $precision)

Generalize the inner types.

Details

at line 49
__construct(Type $type, BuilderHelper $builderHelper, Type|null $relationType = null, bool $modelQuery = false)

Create a builder-of type.

Parameters

Type $type
BuilderHelper $builderHelper
Type|null $relationType
bool $modelQuery

whether the type is newModelQuery()'s builder, written model-query-of

at line 60
protected Type getResult()

Resolve the builder type of each model the type stands for.

Return Value

Type

at line 103
bool isResolvable()

Determine whether the type can be resolved, which waits for its template types.

Return Value

bool

at line 114
array getReferencedClasses()

Get the classes the type refers to.

Return Value

array

at line 124
array getReferencedTemplateTypes(TemplateTypeVariance $positionVariance)

Get the template types the type refers to.

Parameters

TemplateTypeVariance $positionVariance

Return Value

array

at line 139
bool equals(Type $type)

Determine whether the type equals another.

Parameters

Type $type

Return Value

bool

at line 150
string describe(VerbosityLevel $level)

Describe the type.

Parameters

VerbosityLevel $level

Return Value

string

at line 161
Type traverse(callable $cb)

Map the inner types.

Parameters

callable $cb

Return Value

Type

at line 176
Type traverseSimultaneously(Type $right, callable $cb)

Map the inner types together with another builder-of type's.

Parameters

Type $right
callable $cb

Return Value

Type

at line 199
TypeNode toPhpDocNode()

Convert the type to a PHPDoc node.

Return Value

TypeNode

at line 221
Type generalize(GeneralizePrecision $precision)

Generalize the inner types.

Parameters

GeneralizePrecision $precision

Return Value

Type