protected function ContentEntity::yieldEntities in Drupal 8
Same name and namespace in other branches
- 9 core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php \Drupal\migrate_drupal\Plugin\migrate\source\ContentEntity::yieldEntities()
- 10 core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php \Drupal\migrate_drupal\Plugin\migrate\source\ContentEntity::yieldEntities()
Loads and yields entities, one at a time.
Parameters
array $ids: The entity IDs.
Return value
\Generator An iterable of the loaded entities.
1 call to ContentEntity::yieldEntities()
- 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 177
Class
- ContentEntity
- Source plugin to get content entities from the current version of Drupal.
Namespace
Drupal\migrate_drupal\Plugin\migrate\sourceCode
protected function yieldEntities(array $ids) {
$storage = $this->entityTypeManager
->getStorage($this->entityType
->id());
foreach ($ids as $id) {
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
$entity = $storage
->load($id);
(yield $this
->toArray($entity));
if ($this->configuration['include_translations']) {
foreach ($entity
->getTranslationLanguages(FALSE) as $language) {
(yield $this
->toArray($entity
->getTranslation($language
->getId())));
}
}
}
}