/** * Loads entities from storage and gives subclasses the chance to transform them, see * {@see transformEntities()}. * * @param $entitiesToSynchronize * @return array */ private function loadEntitiesFromStorage($entitiesToSynchronize) { if ($this->selectiveSynchronization) { $entities = array(); foreach ($entitiesToSynchronize as $entityToSynchronize) { if ($this->storage->exists($entityToSynchronize['vp_id'], $entityToSynchronize['parent'])) { $entities[] = $this->storage->loadEntity($entityToSynchronize['vp_id'], $entityToSynchronize['parent']); } else { if ($this->storage->exists($entityToSynchronize['vp_id'], null)) { $entities[] = $this->storage->loadEntity($entityToSynchronize['vp_id'], null); } } } } else { $entities = $this->storage->loadAll(); } $entities = $this->transformEntities($entities); return $entities; }
/** * Loads entities from storage. For full synchronization it loads all entities. For selective synchronization it loads * only entities from $this->entitiesToSynchronize. * * @return array */ private function loadEntitiesFromStorage() { if ($this->isSelectiveSynchronization) { $entities = []; foreach ($this->entitiesToSynchronize as $entityToSynchronize) { if ($this->storage->exists($entityToSynchronize['vp_id'], $entityToSynchronize['parent'])) { $entities[] = $this->storage->loadEntity($entityToSynchronize['vp_id'], $entityToSynchronize['parent']); } } } else { $entities = $this->storage->loadAll(); } $entities = $this->maybeStripMetaEntities($entities); $entities = array_map(function ($entity) { return $this->urlReplacer->restore($entity); }, $entities); $entities = array_map(function ($entity) { return $this->vpidRepository->restoreForeignKeys($this->entityName, $entity); }, $entities); return $entities; }
public function loadEntityByName($name, $parentId) { $parent = $this->parentStorage->loadEntity($parentId, null); return $this->extractEntityFromParentByName($parent, $name); }