Skip to content

Commit

Permalink
Fix drush dkan:datastore:list (#4095)
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-m authored Jan 17, 2024
1 parent a8c2f44 commit 8e7da70
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions modules/datastore/drush.services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
- '@dkan.datastore.service.post_import'
- '@dkan.datastore.service.resource_localizer'
- '@dkan.metastore.resource_mapper'
- '@dkan.datastore.import_info_list'
tags:
- { name: drush.command }
datastore.purger.commands:
Expand Down
14 changes: 12 additions & 2 deletions modules/datastore/src/Drush.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Consolidation\OutputFormatters\StructuredData\RowsOfFields;
use Consolidation\OutputFormatters\StructuredData\UnstructuredListData;
use Drupal\common\DataResource;
use Drupal\datastore\Service\Info\ImportInfoList;
use Drupal\datastore\Service\ResourceLocalizer;
use Drupal\metastore\MetastoreService;
use Drupal\datastore\Service\PostImport;
Expand Down Expand Up @@ -54,6 +55,13 @@ class Drush extends DrushCommands {
*/
protected ResourceMapper $resourceMapper;

/**
* Import info list service.
*
* @var \Drupal\datastore\Service\Info\ImportInfoList
*/
private ImportInfoList $importInfoList;

/**
* Constructor for DkanDatastoreCommands.
*/
Expand All @@ -62,14 +70,16 @@ public function __construct(
DatastoreService $datastoreService,
PostImport $postImport,
ResourceLocalizer $resourceLocalizer,
ResourceMapper $resourceMapper
ResourceMapper $resourceMapper,
ImportInfoList $importInfoList
) {
parent::__construct();
$this->metastoreService = $metastoreService;
$this->datastoreService = $datastoreService;
$this->postImport = $postImport;
$this->resourceLocalizer = $resourceLocalizer;
$this->resourceMapper = $resourceMapper;
$this->importInfoList = $importInfoList;
}

/**
Expand Down Expand Up @@ -147,7 +157,7 @@ public function list($options = [
$status = $options['status'];
$uuid_only = $options['uuid-only'];

$list = $this->datastoreService->list();
$list = $this->importInfoList->buildList();
$rows = [];
foreach ($list as $uuid => $item) {
$rows[] = $this->createRow($uuid, $item);
Expand Down

0 comments on commit 8e7da70

Please sign in to comment.