Dummy which can be overwritten by a parent class, this is a hook executed in every getter of the properties in the object
public preGetValue ( string $key ) | ||
$key | string |
/** * enables inheritance for field collections, if xxxInheritance field is available and set to string 'true' * * @param string $key * @return mixed|\Pimcore\Model\Object\Fieldcollection */ public function preGetValue($key) { if ($this->getClass()->getAllowInherit() && \Pimcore\Model\Object\AbstractObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition($key) instanceof \Pimcore\Model\Object\ClassDefinition\Data\Fieldcollections) { $checkInheritanceKey = $key . "Inheritance"; if ($this->{'get' . $checkInheritanceKey}() == "true") { $parentValue = $this->getValueFromParent($key); $data = $this->{$key}; if (!$data) { $data = $this->getClass()->getFieldDefinition($key)->preGetData($this); } if (!$data) { return $parentValue; } else { if (!empty($parentValue)) { $value = new \Pimcore\Model\Object\Fieldcollection($parentValue->getItems()); if (!empty($data)) { foreach ($data as $entry) { $value->add($entry); } } } else { $value = new \Pimcore\Model\Object\Fieldcollection($data->getItems()); } return $value; } } } return parent::preGetValue($key); }