Unverified Commit 20b6597c authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3554978 by phenaproxima, alexpott: ContentExportCommand::loadEntities()...

Issue #3554978 by phenaproxima, alexpott: ContentExportCommand::loadEntities() should use loadByProperties()

(cherry picked from commit ea75fec9)
parent d41e8774
Loading
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -147,19 +147,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int
   *   A generator that yields content entities.
   */
  private function loadEntities(ContentEntityStorageInterface $storage, string|int|null $entity_id, array $bundles = []): iterable {
    $query = $storage->getQuery()
      ->accessCheck(FALSE);
    $values = [];

    $entity_type = $storage->getEntityType();
    if ($bundles) {
      $query->condition($entity_type->getKey('bundle'), $bundles, 'IN');
      $values[$entity_type->getKey('bundle')] = $bundles;
    }
    if ($entity_id) {
      $query->condition($entity_type->getKey('id'), $entity_id);
    }
    foreach ($query->execute() as $id) {
      yield $storage->load($id);
      $values[$entity_type->getKey('id')] = $entity_id;
    }
    return $storage->loadByProperties($values);
  }

}