/** * Populate this proxy by asking the $population closure. * * @return object The instance (hopefully) returned */ public function _loadRealInstance() { // this check safeguards against a proxy being activated multiple times // usually that does not happen, but if the proxy is held from outside // its parent ... the result would be weird. if ($this->parentObject->_getProperty($this->propertyName) instanceof \TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy) { $objects = $this->dataMapper->fetchRelated($this->parentObject, $this->propertyName, $this->fieldValue, false, false); $propertyValue = $this->dataMapper->mapResultToPropertyValue($this->parentObject, $this->propertyName, $objects); $this->parentObject->_setProperty($this->propertyName, $propertyValue); $this->parentObject->_memorizeCleanState($this->propertyName); return $propertyValue; } else { return $this->parentObject->_getProperty($this->propertyName); } }
/** * This is a function lazy load implementation. * * @return void */ protected function initialize() { if (!$this->isInitialized) { $this->isInitialized = TRUE; $objects = $this->dataMapper->fetchRelated($this->parentObject, $this->propertyName, $this->fieldValue, FALSE); foreach ($objects as $object) { parent::attach($object); } $this->_memorizeCleanState(); if (!$this->isStorageAlreadyMemorizedInParentCleanState()) { $this->parentObject->_memorizeCleanState($this->propertyName); } } }