Methods |
public
|
getEntity(): class-string<TEntity>
Get the entity to which the rules apply
Get the entity to which the rules apply
Implemented by
|
#
|
public
|
merge<T is TEntity>(static<T> $rules): static<T>
Merge with another instance, giving precedence to its values if there are
any conflicts
Merge with another instance, giving precedence to its values if there are
any conflicts
An exception is thrown if $rules does not apply to the same entity or
one of its subclasses.
Implemented by
|
#
|
public
|
getRemovableKeys<T0 is object, T1 is T0>(
class-string<T1>|null $class,
class-string<T0>|null $baseClass,
string[] $path,
): array<string, string>
Get keys to remove from a serialized class at a given path
Get keys to remove from a serialized class at a given path
If $baseClass is given, rules applied to $class and its parents up to
but not including $baseClass are considered, otherwise the only
class-based rules considered are those applied to $class .
Returns
Keys and values are the same.
Implemented by
|
#
|
public
|
getReplaceableKeys<T0 is object, T1 is T0>(
class-string<T1>|null $class,
class-string<T0>|null $baseClass,
string[] $path,
): array<string, array{(int|string|null), ((Closure(mixed $value): mixed)|null)}>
Get keys to replace in a serialized class at a given path
Get keys to replace in a serialized class at a given path
If $baseClass is given, rules applied to $class and its parents up to
but not including $baseClass are considered, otherwise the only
class-based rules considered are those applied to $class .
Returns
Each
key is mapped to an array with two values, one of which may be null :
- a new key for the value
- a closure to return a new value for the key
Implemented by
|
#
|
public
|
getDateFormatter(): ?DateFormatterInterface
Get a date formatter to serialize date and time values
Get a date formatter to serialize date and time values
Implemented by
|
#
|
public
|
withDateFormatter(?DateFormatterInterface $formatter): static
Get an instance that uses the given date formatter to serialize date and
time values
Get an instance that uses the given date formatter to serialize date and
time values
{@see DateTimeInterface} instances are serialized as ISO-8601 strings if
no date formatter is provided.
Implemented by
|
#
|
public
|
getIncludeMeta(): bool
Check if undeclared property values are serialized
Check if undeclared property values are serialized
Implemented by
|
#
|
public
|
withIncludeMeta(?bool $include = true): static
Get an instance that serializes undeclared property values
Get an instance that serializes undeclared property values
Implemented by
|
#
|
public
|
getSortByKey(): bool
Check if serialized entities are sorted by key
Check if serialized entities are sorted by key
Implemented by
|
#
|
public
|
withSortByKey(?bool $sort = true): static
Get an instance that sorts serialized entities by key
Get an instance that sorts serialized entities by key
Implemented by
|
#
|
public
|
getMaxDepth(): int
Get the maximum depth of nested values
Get the maximum depth of nested values
Implemented by
|
#
|
public
|
withMaxDepth(?int $depth): static
Get an instance that limits the depth of nested values
Get an instance that limits the depth of nested values
Implemented by
|
#
|
public
|
getDetectRecursion(): bool
Check if recursion is detected when serializing nested entities
Check if recursion is detected when serializing nested entities
Implemented by
|
#
|
public
|
withDetectRecursion(?bool $detect = true): static
Get an instance that detects recursion when serializing nested entities
Get an instance that detects recursion when serializing nested entities
If it would be impossible for a circular reference to arise during
serialization, disable recursion detection to improve performance and
reduce memory consumption.
Implemented by
|
#
|
public
|
getRecurseRules(): bool
Check if path-based rules are applied to nested instances of the entity
Check if path-based rules are applied to nested instances of the entity
Implemented by
|
#
|
public
|
withRecurseRules(?bool $recurse = true): static
Get an instance that applies path-based rules to nested instances of the
entity
Get an instance that applies path-based rules to nested instances of the
entity
Implemented by
|
#
|