TraversableTypedDataInterface
interface TraversableTypedDataInterface implements TypedDataInterface, Traversable (View source)
An interface for typed data objects that can be traversed.
Methods
Constructs a TypedData object given its definition and context.
Validates the currently set data value.
Returns the parent data structure; i.e. either complex data or a list.
Returns the root of the typed data tree.
Sets the context of a property or item via a context aware parent.
React to changes to a child property or item.
Details
static
createInstance(DataDefinitionInterface $definition, string|null $name = NULL, TraversableTypedDataInterface $parent = NULL)
Constructs a TypedData object given its definition and context.
DataDefinitionInterface
getDataDefinition()
Gets the data definition.
mixed
getValue()
Gets the data value.
setValue(mixed|null $value, bool $notify = TRUE)
Sets the data value.
string
getString()
Returns a string representation of the data.
array
getConstraints()
Gets a list of validation constraints.
ConstraintViolationListInterface
validate()
Validates the currently set data value.
$this
applyDefaultValue(bool $notify = TRUE)
Applies the default value.
string|int|null
getName()
Returns the name of a property or item.
TraversableTypedDataInterface|null
getParent()
Returns the parent data structure; i.e. either complex data or a list.
TraversableTypedDataInterface
getRoot()
Returns the root of the typed data tree.
Returns the root data for a tree of typed data objects; e.g. for an entity field item the root of the tree is its parent entity object.
string
getPropertyPath()
Returns the property path of the data.
The trail of property names relative to the root of the typed data tree, separated by dots; e.g. 'field_text.0.format'.
setContext(string|null $name = NULL, TraversableTypedDataInterface $parent = NULL)
Sets the context of a property or item via a context aware parent.
This method is supposed to be called by the factory only.
onChange($name)
React to changes to a child property or item.
Note that this is invoked after any changes have been applied.