CreationContextFactory
class CreationContextFactory
Properties
| protected ValidationStrategy | $validationStrategy | ||
| protected bool | $mapPropertyNames | ||
| protected bool | $disableMagicalCreation | ||
| protected list<string> | $ignoredMagicalMethods | ||
| protected Cast|Cast>> | $casts | ||
| protected Normalizer>|Normalizer> | $normalizers | ||
| protected Closure> | $prepareDataHooks | ||
| protected Closure> | $beforeValidationHooks | ||
| protected Closure> | $beforeRulesHooks | ||
| protected Closure> | $afterRulesHooks | ||
| protected Closure> | $withValidatorHooks | ||
| protected Closure> | $afterValidationHooks | ||
| protected Closure> | $beforeCreationHooks | ||
| protected Closure> | $afterCreationHooks |
Methods
Create a fresh data construction factory.
Set the validation strategy.
Disable validation.
Validate only Request sources.
Validate every source.
Enable or disable property-name mapping.
Disable or enable property-name mapping.
Disable or enable named creation methods.
Enable or disable named creation methods.
Ignore named creation methods for this operation.
Merge casts for declared base types.
Build immutable options for one root operation.
Invalidate the immutable Create context after factory customization.
Get validation rules for a payload.
Collect data objects.
Create typed items without whole-collection factory dispatch.
Details
at line 80
__construct(DataCreator $creator, DataConfig $config, string $dataClass, CreationContext|null $createContext = null)
Create a fresh data construction factory.
at line 94
CreationContextFactory
validationStrategy(ValidationStrategy $validationStrategy)
Set the validation strategy.
at line 105
CreationContextFactory
withoutValidation()
Disable validation.
at line 113
CreationContextFactory
onlyValidateRequests()
Validate only Request sources.
at line 123
CreationContextFactory
alwaysValidate()
Validate every source.
at line 131
CreationContextFactory
withPropertyNameMapping(bool $withPropertyNameMapping = true)
Enable or disable property-name mapping.
at line 142
CreationContextFactory
withoutPropertyNameMapping(bool $withoutPropertyNameMapping = true)
Disable or enable property-name mapping.
at line 155
CreationContextFactory
withoutMagicalCreation(bool $withoutMagicalCreation = true)
Disable or enable named creation methods.
at line 166
CreationContextFactory
withMagicalCreation(bool $withMagicalCreation = true)
Enable or disable named creation methods.
at line 177
CreationContextFactory
ignoreMagicalMethod(string ...$methods)
Ignore named creation methods for this operation.
at line 190
CreationContextFactory
withCast(string $castable, Cast|string $cast)
Add a cast for a declared base type.
at line 203
CreationContextFactory
withCastCollection(array $casts)
Merge casts for declared base types.
at line 216
CreationContextFactory
withNormalizers(Normalizer|string ...$normalizers)
Add custom source normalizers.
at line 227
CreationContextFactory
prepareData(Closure $hook)
Add a prepare-data hook.
at line 238
CreationContextFactory
beforeValidation(Closure $hook)
Add a before-validation hook.
at line 249
CreationContextFactory
beforeRules(Closure $hook)
Add a before-rules hook.
at line 260
CreationContextFactory
afterRules(Closure $hook)
Add an after-rules hook.
at line 271
CreationContextFactory
withValidator(Closure $hook)
Add a validator customization hook.
at line 282
CreationContextFactory
afterValidation(Closure $hook)
Add an after-validation hook.
at line 293
CreationContextFactory
beforeCreation(Closure $hook)
Add a before-creation hook.
at line 304
CreationContextFactory
afterCreation(Closure $hook)
Add an after-creation hook.
at line 317
CreationContext
get(CreationMode $mode = CreationMode::Create)
Build immutable options for one root operation.
at line 356
protected void
invalidateCreateContext()
Invalidate the immutable Create context after factory customization.
at line 366
BaseData
from(mixed ...$payloads)
Create a data object.
at line 374
Arrayable|array
validate(Arrayable|array $payload)
Validate a payload without casting or construction.
at line 388
array
getValidationRules(array $payload)
Get validation rules for a payload.
at line 469
array|DataCollection|PaginatedDataCollection|CursorPaginatedDataCollection|Enumerable|AbstractPaginator|Paginator|AbstractCursorPaginator|CursorPaginator|LazyCollection|Collection
collect(mixed $items, string|null $into = null)
Collect data objects.
Contract-typed sources retain every possible rebuildable runtime shape.
at line 486
Enumerable
collectItems(mixed $items)
| internal |
Create typed items without whole-collection factory dispatch.