DataCreator
class DataCreator
Properties
| protected CreationContext> | $defaultContexts |
Methods
Create a data creator.
Create a fresh construction factory for a data class.
Create a data object through one fixed construction operation.
Validate a payload without casting or construction.
Get validation rules for a payload without running the Validator.
Resolve one deferred automatic lazy property.
Collect data objects through one root operation.
Create typed items through one internal collection operation.
Collect a deferred source without enumerating it.
Create a deferred item collection with one shared operation memo.
Create one nested node without restarting root validation or authorization.
Collect an eager source through one Fill and validation graph.
Create every eager item through one Fill and validation graph.
Batch relations explicitly selected by data properties.
Fill every eager root collection item into one construction state.
Cast and instantiate every eager root collection item.
Run the fixed operation through its selected exit point.
Normalize and fill one data node into the root construction state.
Fill one post-factory value through the general construction path.
Create one fixed array node without entering the general Fill path.
Fill one node introduced or changed by a validation payload hook.
Write one resolved data node and recursively fill its declared children.
Write one resolved property and recursively fill its declared children.
Apply one root payload-hook stage and reconcile changed selections.
Reconcile changed eager root collection items.
Reconcile one changed assembled data node without replaying prepare hooks.
Reconcile one changed property selection.
Reconcile one changed typed data iterable.
Cast and instantiate the node at the current construction path.
Build one automatic lazy property around the ordinary cast path.
Cast one supplied property value.
Cast every item in one declared data iterable.
Cast every item in one declared non-data iterable.
Cast one declared iterable item.
Resolve one automatic lazy attribute for the current root operation.
Get the ordered custom casts applicable to a property.
Resolve one cast once for the current root operation.
Resolve the custom normalizers for one data class.
Resolve every declared property against the normalized sources.
Resolve one property with mapped-key precedence inside each source.
Resolve the raw source aligned with one automatic lazy property.
Match one property against one normalized source.
Get the effective input key for one property.
Merge normalized sources for a prepare-data hook.
Project a non-enumerable normalized source into declared wire keys.
Recursively fill only values absent from the earlier source.
Find the first compatible named object factory.
Resolve a named factory and normalize its remaining payloads.
Find the first compatible named collection factory.
Invoke one matched named factory without method-binding interception.
Resolve the concrete class selected by an abstract property's discriminator.
Materialize a property default only when morph selection requires it.
Determine if an automatic lazy property needs deferred Fill replay.
Determine if a property uses model relation automatic lazy loading.
Retain source metadata for one declared paginator property.
Convert an eager iterable to its keyed values.
Details
at line 72
__construct(Container $container, DataClassRepository $dataClasses, DataConfig $config, DataCollectableFactory $dataCollectables, DataInstantiator $instantiator, DataValidator $validator)
Create a data creator.
at line 90
CreationContextFactory
factory(string $class)
Create a fresh construction factory for a data class.
at line 112
BaseData
create(string $class, CreationContext $context, mixed ...$payloads)
Create a data object through one fixed construction operation.
at line 130
array
validate(string $class, CreationContext $context, array $payloads)
Validate a payload without casting or construction.
at line 148
array
getValidationRules(string $class, CreationContext $context, array $payloads)
Get validation rules for a payload without running the Validator.
at line 164
mixed
resolveAutoLazyProperty(string $propertyName, mixed $value, ConstructionState $state, AutoLazyReplayMode|null $replay)
| internal |
Resolve one deferred automatic lazy property.
at line 207
array|DataCollection|PaginatedDataCollection|CursorPaginatedDataCollection|Enumerable|AbstractPaginator|Paginator|AbstractCursorPaginator|CursorPaginator|LazyCollection|Collection
collect(string $class, CreationContext $context, mixed $items, string|null $into = null)
Collect data objects through one root operation.
at line 250
Enumerable
collectItems(string $class, CreationContext $context, mixed $items)
| internal |
Create typed items through one internal collection operation.
at line 293
protected array|DataCollection|PaginatedDataCollection|CursorPaginatedDataCollection|Enumerable|AbstractPaginator|Paginator|AbstractCursorPaginator|CursorPaginator|LazyCollection|Collection
collectLazy(string $class, CreationContext $context, LazyCollection $source, string|null $into)
Collect a deferred source without enumerating it.
at line 321
protected LazyCollection
deferCollectionItems(string $class, CreationContext $context, LazyCollection $source)
Create a deferred item collection with one shared operation memo.
at line 351
protected BaseData
createUnvalidatedNode(string $class, CreationContext $context, array $payloads, array $extensions)
Create one nested node without restarting root validation or authorization.
at line 412
protected array|DataCollection|PaginatedDataCollection|CursorPaginatedDataCollection|Enumerable|AbstractPaginator|Paginator|AbstractCursorPaginator|CursorPaginator|LazyCollection|Collection
collectEager(string $class, CreationContext $context, mixed $source, array $values, string|null $into, bool $shouldValidate)
Collect an eager source through one Fill and validation graph.
at line 448
protected array
createEagerCollectionItems(string $class, CreationContext $context, mixed $source, array $values, bool $shouldValidate)
Create every eager item through one Fill and validation graph.
at line 514
protected void
loadMissingRelations(string $class, Collection $models)
Batch relations explicitly selected by data properties.
at line 545
protected void
fillCollectionItems(string $class, array $values, ConstructionState $state, array $extensions, bool $shouldValidate)
Fill every eager root collection item into one construction state.
at line 588
protected array
castCollectionItems(string $class, ConstructionState $state, array $extensions)
Cast and instantiate every eager root collection item.
at line 621
protected BaseData|array
execute(string $class, CreationContext $context, array $payloads)
Run the fixed operation through its selected exit point.
at line 714
protected BaseData|null
fillNode(string $class, array $payloads, ConstructionState $state, array $extensions, bool $shouldValidate, bool $compilesRules)
Normalize and fill one data node into the root construction state.
Factory matching consumes caller keys. Every later source-indexed operation receives a list.
at line 760
protected void
fillGeneralNode(DataClass $dataClass, array $payloads, ConstructionState $state, array $extensions, bool $shouldValidate, bool $compilesRules)
Fill one post-factory value through the general construction path.
at line 833
protected BaseData|null
tryCreateDirectArrayNode(DataClass $dataClass, array $payloads, CreationContext $context, array $extensions, bool $shouldValidate, bool $compilesRules)
Create one fixed array node without entering the general Fill path.
The complete node is checked before conversion so a later miss cannot repeat a nested factory, hook, or constructor when the caller enters general Fill.
at line 962
protected BaseData|null
fillHookNode(string $class, mixed $payload, ConstructionState $state, array $extensions, bool $shouldValidate, bool $compilesRules)
Fill one node introduced or changed by a validation payload hook.
at line 1014
protected void
fillResolvedProperties(DataClass $dataClass, array $resolvedProperties, array $sources, array $payloads, ConstructionState $state, array $extensions, bool $shouldValidate, bool $compilesRules, bool $fromValidationHook)
Write one resolved data node and recursively fill its declared children.
at line 1113
protected void
fillResolvedProperty(DataProperty $property, array $inputPath, mixed $value, ConstructionState $state, array $extensions, bool $shouldValidate, bool $compilesRules, bool $fromValidationHook)
Write one resolved property and recursively fill its declared children.
at line 1255
protected void
applyPayloadHooks(string $class, array $hooks, ConstructionState $state, array $extensions, bool $shouldValidate, bool $compilesRules, bool $reconcile = true, bool $collection = false)
Apply one root payload-hook stage and reconcile changed selections.
at line 1311
protected void
reconcileCollection(string $class, array $previousPayload, array $payload, ConstructionState $state, array $extensions, bool $shouldValidate, bool $compilesRules)
Reconcile changed eager root collection items.
at line 1394
protected void
reconcileNode(string $declaredClass, array $previousPayload, array $payload, ConstructionState $state, array $extensions, bool $shouldValidate, bool $compilesRules)
Reconcile one changed assembled data node without replaying prepare hooks.
at line 1480
protected void
reconcileProperty(DataProperty $property, mixed $previousValue, mixed $value, string|int $wireKey, array $payload, ConstructionState $state, array $extensions, bool $shouldValidate, bool $compilesRules)
Reconcile one changed property selection.
at line 1629
protected void
reconcileDataIterable(DataProperty $property, NamedType $type, mixed $previousValue, mixed $value, array $inputPath, ConstructionState $state, array $extensions, bool $shouldValidate, bool $compilesRules)
Reconcile one changed typed data iterable.
at line 1746
protected BaseData
castAndInstantiateNode(ConstructionState $state, array $extensions)
Cast and instantiate the node at the current construction path.
at line 1829
protected mixed
buildAutoLazy(DataProperty $property, mixed $value, ConstructionState $state, array $extensions)
Build one automatic lazy property around the ordinary cast path.
at line 1874
protected mixed
castProperty(DataProperty $property, mixed $value, ConstructionState $state, array $extensions)
Cast one supplied property value.
at line 2029
protected mixed
castDataIterable(DataProperty $property, NamedType $type, mixed $value, ConstructionState $state, array $extensions)
Cast every item in one declared data iterable.
at line 2105
protected mixed
castTypedIterable(DataProperty $property, NamedType $type, mixed $value, ConstructionState $state, array $extensions, array $casts)
Cast every item in one declared non-data iterable.
at line 2163
protected mixed
castIterableItem(DataProperty $property, Type $type, mixed $value, ConstructionState $state, array $extensions, array $casts)
Cast one declared iterable item.
at line 2259
protected AutoLazy
resolveAutoLazy(DataProperty $property, array $extensions)
Resolve one automatic lazy attribute for the current root operation.
at line 2280
protected array
propertyCasts(DataProperty $property, CreationContext $context, array $extensions)
Get the ordered custom casts applicable to a property.
at line 2318
protected Cast
resolveCast(Cast|string $cast, array $extensions)
Resolve one cast once for the current root operation.
at line 2336
protected array
resolveNormalizers(DataClass $dataClass, CreationContext $context, array $extensions)
Resolve the custom normalizers for one data class.
at line 2395
protected array
resolveProperties(DataClass $dataClass, array $sources, CreationContext $context)
Resolve every declared property against the normalized sources.
at line 2415
protected array
resolveProperty(array $sources, DataProperty $property, CreationContext $context)
Resolve one property with mapped-key precedence inside each source.
at line 2439
protected mixed
resolveAutoLazySource(DataProperty $property, array $sources, array $payloads, CreationContext $context)
Resolve the raw source aligned with one automatic lazy property.
at line 2471
protected array|null
matchPropertySource(array|Normalized $source, DataProperty $property, string|int $mappedKey)
Match one property against one normalized source.
at line 2496
protected string|int
propertyInputKey(DataProperty $property, CreationContext $context)
Get the effective input key for one property.
at line 2511
protected array
mergeSources(DataClass $dataClass, array $sources, CreationContext $context)
Merge normalized sources for a prepare-data hook.
at line 2533
protected array
projectNormalizedSource(DataClass $dataClass, Normalized $source, CreationContext $context)
Project a non-enumerable normalized source into declared wire keys.
at line 2564
protected array
mergeMissingValues(array $target, array $source)
Recursively fill only values absent from the earlier source.
at line 2587
protected array|null
matchNamedFactory(DataClass $dataClass, CreationContext $context, array $payloads)
Find the first compatible named object factory.
at line 2621
protected BaseData|array
resolveFactoryPayloads(DataClass $dataClass, CreationContext $context, array $payloads)
Resolve a named factory and normalize its remaining payloads.
Caller keys remain meaningful through factory matching and are discarded afterwards.
at line 2645
protected array|null
matchNamedCollectionFactory(DataClass $dataClass, CreationContext $context, mixed $items, string|null $into)
Find the first compatible named collection factory.
at line 2676
protected mixed
invokeNamedFactory(DataClass $dataClass, DataMethod $method, DataMethodMatch $match)
Invoke one matched named factory without method-binding interception.
at line 2695
protected string
resolveMorphClass(DataClass $dataClass, array $resolvedProperties)
Resolve the concrete class selected by an abstract property's discriminator.
at line 2753
protected mixed
propertyDefaultValue(DataClass $dataClass, DataProperty $property)
Materialize a property default only when morph selection requires it.
at line 2775
protected bool
requiresAutoLazyReplay(DataProperty $property)
Determine if an automatic lazy property needs deferred Fill replay.
at line 2792
protected bool
isAutoWhenLoaded(DataProperty $property)
Determine if a property uses model relation automatic lazy loading.
at line 2803
protected void
retainPaginatorSource(DataProperty $property, NamedType $type, mixed $value, array $inputPath, ConstructionState $state)
Retain source metadata for one declared paginator property.
at line 2828
protected array|null
iterableValues(mixed $value)
Convert an eager iterable to its keyed values.