Pimcore\Model\Object\ClassDefinition\Data\Fieldcollections::preGetData PHP Method

preGetData() public method

public preGetData ( $object, array $params = [] ) : null | Fieldcollection
$object
$params array
return null | Pimcore\Model\Object\Fieldcollection
    public function preGetData($object, $params = [])
    {
        if (!$object instanceof Object\Concrete) {
            throw new \Exception("Field Collections are only valid in Objects");
        }
        $data = $object->{$this->getName()};
        if ($this->getLazyLoading() and !in_array($this->getName(), $object->getO__loadedLazyFields())) {
            $data = $this->load($object, ["force" => true]);
            $setter = "set" . ucfirst($this->getName());
            if (method_exists($object, $setter)) {
                $object->{$setter}($data);
            }
        }
        return $data;
    }