From 58d2e87ae2d1776316f4432ab6c1960e497abf72 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Thu, 5 Oct 2023 11:11:54 +0200 Subject: [PATCH] TEAMMANAGE-2784: Added digital post id filter on envelope list command --- src/Command/DigitalPostEnvelopeListCommand.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Command/DigitalPostEnvelopeListCommand.php b/src/Command/DigitalPostEnvelopeListCommand.php index 600183ef..6da8f243 100644 --- a/src/Command/DigitalPostEnvelopeListCommand.php +++ b/src/Command/DigitalPostEnvelopeListCommand.php @@ -37,6 +37,7 @@ protected function configure() { $this ->addOption('status', null, InputOption::VALUE_REQUIRED, 'Show only envelopes with this status') + ->addOption('digital-post-id', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Digital post id') ->addOption('digital-post-subject', null, InputOption::VALUE_REQUIRED, 'Show only envelopes with subject matching this LIKE expression') ->addOption('max-results', null, InputOption::VALUE_REQUIRED, 'Show at most this many envelopes', 10) ->addOption('id', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Envelope id') @@ -134,6 +135,14 @@ private function findEnvelopes(InputInterface $input): array ->setParameter('status', $status) ; } + if ($digitalPostIds = $input->getOption('digital-post-id')) { + $digitalPostIds = array_map(static fn (string $id) => Uuid::fromString($id)->toBinary(), $digitalPostIds); + $qb + ->join('e.digitalPost', 'p_id') + ->andWhere('p_id.id IN (:digitalPostIds)') + ->setParameter('digitalPostIds', $digitalPostIds) + ; + } if ($subject = $input->getOption('digital-post-subject')) { $qb ->join('e.digitalPost', 'p')