Skip to content

Commit

Permalink
BUGFIX: fix RepositoryDataSource
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaip committed Mar 28, 2018
1 parent 14fd546 commit fc3038b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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 `"[email protected]","User Name","subscriptionId1|subscriptionId2"`
Expand Down Expand Up @@ -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('-------------------------------------------------------------------------------');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit fc3038b

Please sign in to comment.