diff --git a/Classes/Psmb/Newsletter/Command/NewsletterCommandController.php b/Classes/Psmb/Newsletter/Command/NewsletterCommandController.php index 088c200..d25cae7 100644 --- a/Classes/Psmb/Newsletter/Command/NewsletterCommandController.php +++ b/Classes/Psmb/Newsletter/Command/NewsletterCommandController.php @@ -5,6 +5,7 @@ use Psmb\Newsletter\Domain\Model\Subscriber; use Psmb\Newsletter\Domain\Repository\SubscriberRepository; use Psmb\Newsletter\Service\FusionMailService; +use Psmb\Newsletter\Service\SubscribersService; use Neos\Flow\Cli\CommandController; /** @@ -36,6 +37,12 @@ class NewsletterCommandController extends CommandController */ protected $subscriptions; + /** + * @Flow\Inject + * @var SubscribersService + */ + protected $subscribersService; + /** * Import newsletter subscribers from CSV. * CSV should be in the format `"user@email.com","User Name","subscriptionId1|subscriptionId2"` @@ -111,7 +118,7 @@ public function sendCommand($subscription = null, $interval = null, $dryRun = nu */ protected function sendLettersForSubscription($subscription, $dryRun) { - $subscribers = $this->subscriberRepository->findBySubscriptionId($subscription['identifier'])->toArray(); + $subscribers = $this->subscribersService->getSubscribers($subscription); $this->outputLine('Sending letters for subscription %s (%s subscribers)', [$subscription['identifier'], count($subscribers)]); $this->outputLine('-------------------------------------------------------------------------------'); diff --git a/Classes/Psmb/Newsletter/Service/DataSource/RepositoryDataSource.php b/Classes/Psmb/Newsletter/Service/DataSource/RepositoryDataSource.php index 916d330..ab9ada7 100644 --- a/Classes/Psmb/Newsletter/Service/DataSource/RepositoryDataSource.php +++ b/Classes/Psmb/Newsletter/Service/DataSource/RepositoryDataSource.php @@ -24,6 +24,6 @@ class RepositoryDataSource extends AbstractDataSource */ public function getData(array $subscription) { - $subscribers = $this->subscriberRepository->findBySubscriptionId($subscription['identifier'])->toArray(); + return $this->subscriberRepository->findBySubscriptionId($subscription['identifier'])->toArray(); } } \ No newline at end of file