/** * Iterate over deleted entities and process them * * @return void * @author Karsten Dambekalns <*****@*****.**> */ protected function processDeletedObjects() { foreach ($this->deletedEntities as $entity) { if ($this->persistenceSession->hasObject($entity)) { $this->removeEntity($entity); $this->persistenceSession->unregisterObject($entity); } } $this->deletedEntities = new \SplObjectStorage(); }
/** * Returns the object with the (internal) identifier, if it is known to the * backend. Otherwise NULL is returned. * * @param string $identifier * @return object The object for the identifier if it is known, or NULL * @author Karsten Dambekalns <*****@*****.**> * @api */ public function getObjectByIdentifier($identifier) { if ($this->persistenceSession->hasIdentifier($identifier)) { return $this->persistenceSession->getObjectByIdentifier($identifier); } else { $objectData = $this->backend->getObjectDataByIdentifier($identifier); if ($objectData !== FALSE) { return $this->dataMapper->mapToObject($objectData); } else { return NULL; } } }
/** * Maps a single record into the object it represents and registers it as * reconstituted with the session. * * @param array $objectData * @return object * @author Karsten Dambekalns <*****@*****.**> */ public function mapToObject(array $objectData) { if ($this->persistenceSession->hasIdentifier($objectData['identifier'])) { return $this->persistenceSession->getObjectByIdentifier($objectData['identifier']); } else { $className = $objectData['classname']; $classSchema = $this->reflectionService->getClassSchema($className); $objectConfiguration = $this->objectManager->getObjectConfiguration($className); $object = $this->objectBuilder->createEmptyObject($className, $objectConfiguration); $this->persistenceSession->registerObject($object, $objectData['identifier']); $this->objectBuilder->reinjectDependencies($object, $objectConfiguration); $this->thawProperties($object, $objectData['identifier'], $objectData, $classSchema); $object->FLOW3_Persistence_memorizeCleanState(); $this->persistenceSession->registerReconstitutedObject($object); return $object; } }