Skip to content

Commit

Permalink
correctly read parameter in command
Browse files Browse the repository at this point in the history
  • Loading branch information
antedebaas committed Jan 20, 2024
1 parent 411950d commit 4b485f3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Command/CheckmailboxCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use Doctrine\ORM\EntityManagerInterface;
use SecIT\ImapBundle\Service\Imap;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;

use App\Entity\Domains;
use App\Entity\MXRecords;
Expand All @@ -32,11 +33,13 @@ class CheckmailboxCommand extends Command
{
private $em;
private $imap;
private $params;

public function __construct(EntityManagerInterface $em, Imap $imap)
public function __construct(EntityManagerInterface $em, Imap $imap, ParameterBagInterface $params)
{
$this->em = $em;
$this->imap = $imap;
$this->params = $params;
parent::__construct();
}

Expand Down Expand Up @@ -276,7 +279,8 @@ private function open_mailbox(Imap $imap):array
$smtptls_reports = array_merge($smtptls_reports,$new_reports['smtptls_reports']);
unlink($attachment->filePath);
}
if ($this->getParameter('app.delete_processed_mails') == true) {

if ($this->params->get('app.delete_processed_mails') == "true") {
$mailbox->deleteMail($mailId);
}
}
Expand Down

0 comments on commit 4b485f3

Please sign in to comment.