/** * 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 // it's parent... the result would be weird. if ($this->parentObject->_getProperty($this->propertyName) instanceof Tx_Extbase_Persistence_LazyLoadingProxy) { $dataMapper = Tx_Extbase_Dispatcher::getPersistenceManager()->getBackend()->getDataMapper(); $objects = $dataMapper->fetchRelated($this->parentObject, $this->propertyName, $this->fieldValue, FALSE, FALSE); $propertyValue = $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(); $this->parentObject->_memorizeCleanState($this->propertyName); } }
/** * This is a function lazy load implementation. * * @return void */ protected function initialize() { if (!$this->isInitialized) { $this->isInitialized = TRUE; $dataMapper = Tx_Extbase_Dispatcher::getPersistenceManager()->getBackend()->getDataMapper(); $objects = $dataMapper->fetchRelated($this->parentObject, $this->propertyName, $this->fieldValue, FALSE); foreach ($objects as $object) { parent::attach($object); } $this->_memorizeCleanState(); $this->parentObject->_memorizeCleanState($this->propertyName); } }