TypedDataInterface
interface TypedDataInterface (View source)
Interface for typed data objects.
Methods
Constructs a TypedData object given its definition and context.
Gets the data definition.
Gets the data value.
Sets the data value.
Returns a string representation of the data.
Gets a list of validation constraints.
Validates the currently set data value.
Applies the default value.
Returns the name of a property or item.
Returns the parent data structure; i.e. either complex data or a list.
Returns the root of the typed data tree.
Returns the property path of the data.
Sets the context of a property or item via a context aware parent.
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.