You are here

public function ExportEntity::getEntitiesList in Content Synchronizer 3.x

Same name and namespace in other branches
  1. 8.2 src/Entity/ExportEntity.php \Drupal\content_synchronizer\Entity\ExportEntity::getEntitiesList()
  2. 8 src/Entity/ExportEntity.php \Drupal\content_synchronizer\Entity\ExportEntity::getEntitiesList()

Return the entities to export list.

Return value

array The list of entities to export.

1 call to ExportEntity::getEntitiesList()
ExportEntity::hasEntity in src/Entity/ExportEntity.php
Check if hte passed entity is already in the entities list.

File

src/Entity/ExportEntity.php, line 271

Class

ExportEntity
Defines the Export entity entity.

Namespace

Drupal\content_synchronizer\Entity

Code

public function getEntitiesList() {
  if (is_null($this->entitiesList)) {
    $result = \Drupal::database()
      ->select(self::TABLE_ITEMS)
      ->fields(self::TABLE_ITEMS, [
      self::FIELD_ENTITY_ID,
      self::FIELD_ENTITY_TYPE,
    ])
      ->condition(self::FIELD_EXPORT_ID, $this
      ->id())
      ->execute();
    $this->entitiesList = [];
    foreach ($result
      ->fetchAll() as $item) {
      $this->entitiesList[$item->{self::FIELD_ENTITY_TYPE} . '_' . $item->{self::FIELD_ENTITY_ID}] = \Drupal::entityTypeManager()
        ->getStorage($item->{self::FIELD_ENTITY_TYPE})
        ->load($item->{self::FIELD_ENTITY_ID});
    }
  }
  return $this->entitiesList;
}