Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* @file
* Contains \Drupal\Core\TypedData\ComplexDataDefinitionBase.
*/
namespace Drupal\Core\TypedData;
/**
* Base class for complex data definitions.
*/
abstract class ComplexDataDefinitionBase extends DataDefinition implements ComplexDataDefinitionInterface {
/**
* An array of data definitions.
*
* @var \Drupal\Core\TypedData\DataDefinitionInterface[]
*/
protected $propertyDefinitions;
/**
* {@inheritdoc}
*/
abstract public function getPropertyDefinitions();
/**
* {@inheritdoc}
*/
public function getPropertyDefinition($name) {
if (!isset($this->propertyDefinitions)) {
$this->getPropertyDefinitions();
}
if (isset($this->propertyDefinitions[$name])) {
return $this->propertyDefinitions[$name];
}
}
/**
* {@inheritdoc}
*/
public function getMainPropertyName() {
return NULL;
}
/**
* {@inheritdoc}
*/
public function __sleep() {
// Do not serialize the cached property definitions.
$vars = get_object_vars($this);
unset($vars['propertyDefinitions']);
return array_keys($vars);
}
}