Implements the magic method for setting object properties.
Uses default language always. For compatibility mode to work this must return a reference.
public function &__get($name) {
// If this is an entity field, handle it accordingly. We first check whether
// a field object has been already created. If not, we create one.
if (isset($this->fields[$name][Language::LANGCODE_DEFAULT])) {
return $this->fields[$name][Language::LANGCODE_DEFAULT];
}
// Inline getPropertyDefinition() to speed up things.
if (!isset($this->fieldDefinitions)) {
$this
->getPropertyDefinitions();
}
if (isset($this->fieldDefinitions[$name])) {
$return = $this
->getTranslatedField($name, Language::LANGCODE_DEFAULT);
return $return;
}
// Allow the EntityBCDecorator to directly access the values and fields.
// @todo: Remove once the EntityBCDecorator gets removed.
if ($name == 'values' || $name == 'fields') {
return $this->{$name};
}
// Else directly read/write plain values. That way, non-field entity
// properties can always be accessed directly.
if (!isset($this->values[$name])) {
$this->values[$name] = NULL;
}
return $this->values[$name];
}