function ContentExportCommand::loadEntities
Find entities to export and yield them one by one.
Parameters
\Drupal\Core\Entity\ContentEntityStorageInterface $storage: The entity storage handler.
string|int|null $entity_id: The ID of the specific entity to load, or NULL to load all entities (probably filtered by bundle).
string[] $bundles: (optional) The bundles to filter by.
Return value
iterable<\Drupal\Core\Entity\ContentEntityInterface> A generator that yields content entities.
File
- 
              core/lib/ Drupal/ Core/ DefaultContent/ ContentExportCommand.php, line 149 
Class
- ContentExportCommand
- Exports content entities in YAML format.
Namespace
Drupal\Core\DefaultContentCode
private function loadEntities(ContentEntityStorageInterface $storage, string|int|null $entity_id, array $bundles = []) : iterable {
  $values = [];
  $entity_type = $storage->getEntityType();
  if ($bundles) {
    $values[$entity_type->getKey('bundle')] = $bundles;
  }
  if ($entity_id) {
    $values[$entity_type->getKey('id')] = $entity_id;
  }
  return $storage->loadByProperties($values);
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
