Newer
Older
Dries Buytaert
committed
<?php
/**
* @file
* Contains \Drupal\Core\TypedData\ComplexDataInterface.
Dries Buytaert
committed
*/
namespace Drupal\Core\TypedData;
/**
* Interface for complex data; i.e. data containing named and typed properties.
*
* The name of a property has to be a valid PHP variable name, starting with
* an alphabetic character.
*
Dries Buytaert
committed
* This is implemented by entities as well as by field item classes of
* entities.
*
* When implementing this interface which extends Traversable, make sure to list
* IteratorAggregate or Iterator before this interface in the implements clause.
*
* @see \Drupal\Core\TypedData\ComplexDataDefinitionInterface
Dries Buytaert
committed
*/
Angie Byron
committed
interface ComplexDataInterface extends \Traversable, TypedDataInterface {
Dries Buytaert
committed
/**
* Gets a property object.
*
* @param $property_name
* The name of the property to get; e.g., 'title' or 'name'.
*
* @throws \InvalidArgumentException
* If an invalid property name is given.
*
* @return \Drupal\Core\TypedData\TypedDataInterface
* The property object.
*/
public function get($property_name);
/**
* Sets a property value.
*
* @param $property_name
* The name of the property to set; e.g., 'title' or 'name'.
* @param $value
* The value to set, or NULL to unset the property.
catch
committed
* @param bool $notify
* (optional) Whether to notify the parent object of the change. Defaults to
* TRUE. If the update stems from a parent object, set it to FALSE to avoid
* being notified again.
Dries Buytaert
committed
*
* @throws \InvalidArgumentException
* If the specified property does not exist.
*
* @return \Drupal\Core\TypedData\TypedDataInterface
* The property object.
*/
catch
committed
public function set($property_name, $value, $notify = TRUE);
Dries Buytaert
committed
/**
* Gets an array of property objects.
*
* @param bool $include_computed
* If set to TRUE, computed properties are included. Defaults to FALSE.
*
* @return \Drupal\Core\TypedData\TypedDataInterface[]
Dries Buytaert
committed
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
* An array of property objects implementing the TypedDataInterface, keyed
* by property name.
*/
public function getProperties($include_computed = FALSE);
/**
* Gets an array of property values.
*
* Gets an array of plain property values including all not-computed
* properties.
*
* @return array
* An array keyed by property name containing the property value.
*/
public function getPropertyValues();
/**
* Sets multiple property values.
*
* @param array
* The array of property values to set, keyed by property name.
*
* @throws \InvalidArgumentException
* If the value of a not existing property is to be set.
* @throws \Drupal\Core\TypedData\ReadOnlyException
* If a read-only property is set.
*/
public function setPropertyValues($values);
/**
* Determines whether the data structure is empty.
*
* @return boolean
* TRUE if the data structure is empty, FALSE otherwise.
*/
public function isEmpty();
catch
committed
/**
* React to changes to a child property.
*
* Note that this is invoked after any changes have been applied.
catch
committed
*
* @param $property_name
* The name of the property which is changed.
*/
public function onChange($property_name);