-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1070 from griidc/release/6.12.0
Release/6.12.0
- Loading branch information
Showing
10 changed files
with
230 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?php | ||
|
||
namespace App\Command; | ||
|
||
use App\Entity\Dataset; | ||
use App\Entity\DatasetSubmission; | ||
use App\Message\ZipDatasetFiles; | ||
use Doctrine\ORM\EntityManagerInterface; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Style\SymfonyStyle; | ||
use Symfony\Component\Messenger\MessageBusInterface; | ||
|
||
/** | ||
* Command to re-queue zip files for a dataset. | ||
*/ | ||
class PelagosReQueueZipCommand extends Command | ||
{ | ||
/** | ||
* @var string $defaultName | ||
*/ | ||
protected static $defaultName = 'pelagos:re-queue-zip'; | ||
|
||
/** | ||
* @var string $defaultDescription | ||
*/ | ||
protected static $defaultDescription = 'Re-queue zip files by UDI'; | ||
|
||
/** | ||
* A Doctrine ORM EntityManager instance. | ||
* | ||
* @var EntityManagerInterface $entityManager | ||
*/ | ||
protected $entityManager; | ||
|
||
/** | ||
* Symfony messenger bus interface. | ||
* | ||
* @var MessageBusInterface $messageBus | ||
*/ | ||
protected $messageBus; | ||
|
||
/** | ||
* The command configuration. | ||
* | ||
* @return void | ||
*/ | ||
protected function configure(): void | ||
{ | ||
$this | ||
->setDescription(self::$defaultDescription) | ||
->addArgument('udi', InputArgument::REQUIRED, 'What is the UDI of the dataset?'); | ||
; | ||
} | ||
|
||
/** | ||
* Class constructor for dependency injection. | ||
* | ||
* @param EntityManagerInterface $entityManager A Doctrine EntityManager. | ||
* @param MessageBusInterface $messageBus Symfony messenger bus interface. | ||
*/ | ||
public function __construct(EntityManagerInterface $entityManager, MessageBusInterface $messageBus) | ||
{ | ||
$this->entityManager = $entityManager; | ||
$this->messageBus = $messageBus; | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Symfony command execute section. | ||
* | ||
* @param InputInterface $input Required by Command. | ||
* @param OutputInterface $output Required by Command. | ||
* | ||
* @return integer Return code. | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$io = new SymfonyStyle($input, $output); | ||
$udi = $input->getArgument('udi'); | ||
$dataset = $this->entityManager->getRepository(Dataset::class)->findOneBy(array( | ||
'udi' => $udi)); | ||
|
||
if ($dataset) { | ||
$datasetSubmission = $dataset->getLatestDatasetReview(); | ||
if ($datasetSubmission instanceof DatasetSubmission) { | ||
$zipFiles = new ZipDatasetFiles($datasetSubmission->getId()); | ||
$this->messageBus->dispatch($zipFiles); | ||
} | ||
} else { | ||
$io->error('No such dataset exists'); | ||
} | ||
|
||
$io->success('Zip files re-queued for the dataset'); | ||
|
||
return 0; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.