LoadSubscribersData possible fix.

This commit is contained in:
Alexey Skobkin 2016-12-12 03:51:41 +03:00
parent 706933b405
commit 88105a4ef1

View file

@ -33,9 +33,8 @@ class LoadSubscribersData extends AbstractFixture implements OrderedFixtureInter
$minimum = mt_rand(0, count($users));
}
$subscribers = $this->getRandomSubscribers($users, $minimum);
foreach ($subscribers as $subscriber) {
if ($minimum) {
foreach ($this->getRandomSubscribers($users, $minimum) as $subscriber) {
$subscription = new Subscription($user,$subscriber);
$subscriptionEvent = new SubscriptionEvent($user, $subscriber, SubscriptionEvent::ACTION_SUBSCRIBE);
$om->persist($subscription);
@ -43,6 +42,7 @@ class LoadSubscribersData extends AbstractFixture implements OrderedFixtureInter
$user->addSubscriber($subscription);
}
}
}
$om->flush();
}