Skip to content

Commit

Permalink
Merge branch 'release/4.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Hirschi committed Apr 7, 2022
2 parents 5b19bea + d31814d commit cb97379
Show file tree
Hide file tree
Showing 20 changed files with 763 additions and 290 deletions.
23 changes: 20 additions & 3 deletions Classes/Command/MailAdminNotificationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,23 @@
class MailAdminNotificationCommand extends Command
{

/**
* FormEntryRepository
*
* @var \Frappant\FrpFormAnswers\Domain\Repository\FormEntryRepository
*/
protected $formEntryRepository;

/**
* Inject FormEntryRepository
*
* @param \Frappant\FrpFormAnswers\Domain\Repository\FormEntryRepository $pageRepository
*/
public function injectFormEntryRepository(FormEntryRepository $formEntryRepository)
{
$this->formEntryRepository = $formEntryRepository;
}

/**
* Configure the command by defining the name, options and arguments.
*/
Expand Down Expand Up @@ -93,7 +110,7 @@ public function execute(InputInterface $input, OutputInterface $output)
throw new Exception('You need to provide at least one email address.');
}

$formEntryRepository = GeneralUtility::makeInstance(ObjectManager::class)->get(FormEntryRepository::class);
// $formEntryRepository = GeneralUtility::makeInstance(ObjectManager::class)->get(FormEntryRepository::class);

$search = GeneralUtility::makeInstance(FormEntryDemand::class);
$search->setAllPids(true);
Expand All @@ -112,7 +129,7 @@ public function execute(InputInterface $input, OutputInterface $output)
} else {
throw new Exception("['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'] is not set.");
}
$records = $formEntryRepository->findByDemand($search);
$records = $this->formEntryRepository->findByDemand($search);

if ($records->count()) {
$output->writeln($records->count()." entries found");
Expand All @@ -121,7 +138,7 @@ public function execute(InputInterface $input, OutputInterface $output)
$output->writeln("Sending entry with uid:".$row->getUid());
$row->setExported(true);
try {
$formEntryRepository->update($row);
$this->formEntryRepository->update($row);
} catch (IllegalObjectTypeException $e) {
$output->writeln($e->getMessage());
return;
Expand Down
Loading

0 comments on commit cb97379

Please sign in to comment.