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,14 +33,14 @@ class LoadSubscribersData extends AbstractFixture implements OrderedFixtureInter
$minimum = mt_rand(0, count($users)); $minimum = mt_rand(0, count($users));
} }
$subscribers = $this->getRandomSubscribers($users, $minimum); if ($minimum) {
foreach ($this->getRandomSubscribers($users, $minimum) as $subscriber) {
foreach ($subscribers as $subscriber) { $subscription = new Subscription($user,$subscriber);
$subscription = new Subscription($user,$subscriber); $subscriptionEvent = new SubscriptionEvent($user, $subscriber, SubscriptionEvent::ACTION_SUBSCRIBE);
$subscriptionEvent = new SubscriptionEvent($user, $subscriber, SubscriptionEvent::ACTION_SUBSCRIBE); $om->persist($subscription);
$om->persist($subscription); $om->persist($subscriptionEvent);
$om->persist($subscriptionEvent); $user->addSubscriber($subscription);
$user->addSubscriber($subscription); }
} }
} }