This commit is contained in:
Alexey Skobkin 2017-01-14 04:02:04 +03:00
parent 1b2df8d4c3
commit 34a9aa8caf

View file

@ -32,13 +32,15 @@ class LoadSubscribersData extends AbstractFixture implements OrderedFixtureInter
]; ];
foreach ($users as $key => $user) { foreach ($users as $key => $user) {
foreach ($subscriptions[$key] as $userId) { if (array_key_exists($key, $subscriptions)) {
$subscriber = $users[$userId]; foreach ($subscriptions[$key] as $userId) {
$subscription = new Subscription($user, $subscriber); $subscriber = $users[$userId];
$subscriptionEvent = new SubscriptionEvent($user, $subscriber, SubscriptionEvent::ACTION_SUBSCRIBE); $subscription = new Subscription($user, $subscriber);
$om->persist($subscription); $subscriptionEvent = new SubscriptionEvent($user, $subscriber, SubscriptionEvent::ACTION_SUBSCRIBE);
$om->persist($subscriptionEvent); $om->persist($subscription);
$user->addSubscriber($subscription); $om->persist($subscriptionEvent);
$user->addSubscriber($subscription);
}
} }
} }