You are here

public function ExportManager::getEntitiesExport in Content Synchronizer 8

Same name and namespace in other branches
  1. 8.2 src/Service/ExportManager.php \Drupal\content_synchronizer\Service\ExportManager::getEntitiesExport()
  2. 3.x src/Service/ExportManager.php \Drupal\content_synchronizer\Service\ExportManager::getEntitiesExport()

Return the list of export for an entity.

Parameters

\Drupal\Core\Entity\Entity $entity: The entity.

Return value

\Drupal\content_synchronizer\Entity\ExportEntity THe list of exports.

1 call to ExportManager::getEntitiesExport()
ExportManager::onEntityDelete in src/Service/ExportManager.php
Action after delete entity.

File

src/Service/ExportManager.php, line 40

Class

ExportManager
The export manager.

Namespace

Drupal\content_synchronizer\Service

Code

public function getEntitiesExport(Entity $entity) {
  if ($result = \Drupal::database()
    ->select(ExportEntity::TABLE_ITEMS)
    ->fields(ExportEntity::TABLE_ITEMS, [
    ExportEntity::FIELD_EXPORT_ID,
  ])
    ->condition(ExportEntity::FIELD_ENTITY_ID, $entity
    ->id())
    ->condition(ExportEntity::FIELD_ENTITY_TYPE, $entity
    ->getEntityTypeId())
    ->execute()) {
    return ExportEntity::loadMultiple($result
      ->fetchCol());
  }
  return [];
}