DoNotDeserialize
extends ObjAttribute
in package
Attribute to exclude a property from deserialization.
Properties marked with #[DoNotDeserialize] will not be populated from incoming data during __unserialize(). Useful for read-only fields or computed properties that should be set by business logic, not API input.
Usage:
class Post extends Obj {
public string $title;
#[DoNotDeserialize]
public DateTime $createdAt;
}
Tags
Attributes
- #[Attribute]
- \Attribute::TARGET_PROPERTY
Table of Contents
Methods
- of() : static|false
- Extract an attribute instance from a reflected property.
Methods
of()
Extract an attribute instance from a reflected property.
public
static of(ReflectionProperty $field) : static|false
Searches the property's attributes for one matching this class name and instantiates it with the attribute's arguments.
Parameters
- $field : ReflectionProperty
-
The property to inspect for attributes.
Return values
static|false —The attribute instance if found, false otherwise.