loadEntity() abstract public method

Load an entity by given VPID
abstract public loadEntity ( string $id, string $parentId ) : array
$id string VPID
$parentId string VPID of parent entity (for example post for postmeta)
return array Array representing an entity
コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
 /**
  * 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;
 }
コード例 #3
0
 public function loadEntityByName($name, $parentId)
 {
     $parent = $this->parentStorage->loadEntity($parentId, null);
     return $this->extractEntityFromParentByName($parent, $name);
 }