Implements TypedDataInterface::__construct().
Overrides TypedData::__construct
public function __construct(array $definition) {
$this->definition = $definition;
// Initialize all property objects, but postpone the creating of computed
// properties to a second step. That way computed properties can safely get
// references on non-computed properties during construction.
$step2 = array();
foreach ($this
->getPropertyDefinitions() as $name => $definition) {
if (empty($definition['computed'])) {
$context = array(
'name' => $name,
'parent' => $this,
);
$this->properties[$name] = typed_data()
->create($definition, NULL, $context);
}
else {
$step2[$name] = $definition;
}
}
foreach ($step2 as $name => $definition) {
$context = array(
'name' => $name,
'parent' => $this,
);
$this->properties[$name] = typed_data()
->create($definition, NULL, $context);
}
}