You are here

public function ContentEntity::query in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php \Drupal\migrate_drupal\Plugin\migrate\source\ContentEntity::query()
  2. 9 core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php \Drupal\migrate_drupal\Plugin\migrate\source\ContentEntity::query()

Query to retrieve the entities.

Return value

\Drupal\Core\Entity\Query\QueryInterface The query.

2 calls to ContentEntity::query()
ContentEntity::doCount in core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php
Gets the source count checking if the source is countable or using the iterator_count function.
ContentEntity::initializeIterator in core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php
Initializes the iterator with the source data.

File

core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php, line 227

Class

ContentEntity
Source plugin to get content entities from the current version of Drupal.

Namespace

Drupal\migrate_drupal\Plugin\migrate\source

Code

public function query() {
  $query = $this->entityTypeManager
    ->getStorage($this->entityType
    ->id())
    ->getQuery()
    ->accessCheck(FALSE);
  if (!empty($this->configuration['bundle'])) {
    $query
      ->condition($this->entityType
      ->getKey('bundle'), $this->configuration['bundle']);
  }

  // Exclude anonymous user account.
  if ($this->entityType
    ->id() === 'user' && !empty($this->entityType
    ->getKey('id'))) {
    $query
      ->condition($this->entityType
      ->getKey('id'), 0, '>');
  }
  return $query;
}