Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix drush dkan:datastore:list #4095

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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