From 34a9aa8caf343327bdc7498e5227a01bc53fb6a4 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Sat, 14 Jan 2017 04:02:04 +0300 Subject: [PATCH] Fix for 1b2df8d. --- .../DataFixtures/ORM/LoadSubscribersData.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Skobkin/Bundle/PointToolsBundle/DataFixtures/ORM/LoadSubscribersData.php b/src/Skobkin/Bundle/PointToolsBundle/DataFixtures/ORM/LoadSubscribersData.php index 942a0f5..4254e9f 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/DataFixtures/ORM/LoadSubscribersData.php +++ b/src/Skobkin/Bundle/PointToolsBundle/DataFixtures/ORM/LoadSubscribersData.php @@ -32,13 +32,15 @@ class LoadSubscribersData extends AbstractFixture implements OrderedFixtureInter ]; foreach ($users as $key => $user) { - foreach ($subscriptions[$key] as $userId) { - $subscriber = $users[$userId]; - $subscription = new Subscription($user, $subscriber); - $subscriptionEvent = new SubscriptionEvent($user, $subscriber, SubscriptionEvent::ACTION_SUBSCRIBE); - $om->persist($subscription); - $om->persist($subscriptionEvent); - $user->addSubscriber($subscription); + if (array_key_exists($key, $subscriptions)) { + foreach ($subscriptions[$key] as $userId) { + $subscriber = $users[$userId]; + $subscription = new Subscription($user, $subscriber); + $subscriptionEvent = new SubscriptionEvent($user, $subscriber, SubscriptionEvent::ACTION_SUBSCRIBE); + $om->persist($subscription); + $om->persist($subscriptionEvent); + $user->addSubscriber($subscription); + } } }