From 545e3dbabdce642e2dfdcd3590511a211c8196b4 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Tue, 25 Oct 2016 19:38:36 +0300 Subject: [PATCH] issue #122 Undefined index: startPoint --- src/Kubikvest/Manager/GroupManager.php | 71 ++++++++++++++------------ 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/src/Kubikvest/Manager/GroupManager.php b/src/Kubikvest/Manager/GroupManager.php index 38f58b8..3f0dae6 100644 --- a/src/Kubikvest/Manager/GroupManager.php +++ b/src/Kubikvest/Manager/GroupManager.php @@ -28,28 +28,33 @@ public function create(Quest $quest) $group->pin = PinCode::gen(); $group->active = true; - $this->mapper->insert([ - 'groupId' => $group->groupId, - 'gameId' => $group->gameId, - 'questId' => $group->questId, - 'pointId' => $group->pointId, - 'pin' => $group->pin, - ]); + $this->mapper->insert( + [ + 'groupId' => $group->groupId, + 'gameId' => $group->gameId, + 'questId' => $group->questId, + 'pointId' => $group->pointId, + 'pin' => $group->pin, + ] + ); return $group; } public function addUser(Group $group) { - $this->mapper->update([ - 'groupId' => $group->groupId, - 'gameId' => $group->gameId, - 'questId' => $group->questId, - 'pointId' => $group->pointId, - 'users' => json_encode($group->getUsers()), - 'pin' => $group->pin, - 'active' => $group->active, - ]); + $this->mapper->update( + [ + 'groupId' => $group->groupId, + 'gameId' => $group->gameId, + 'questId' => $group->questId, + 'pointId' => $group->pointId, + 'users' => json_encode($group->getUsers()), + 'pin' => $group->pin, + 'startPoint' => '', + 'active' => $group->active, + ] + ); } public function get($groupId, $active = true) @@ -57,29 +62,31 @@ public function get($groupId, $active = true) $data = $this->mapper->getGroup($groupId, $active); $group = new Group($this); - $group->groupId = $data['groupId']; - $group->gameId = $data['gameId']; - $group->questId = $data['questId']; - $group->pointId = $data['pointId']; $group->setUsers($data['users']); - $group->pin = $data['pin']; + $group->groupId = $data['groupId']; + $group->gameId = $data['gameId']; + $group->questId = $data['questId']; + $group->pointId = $data['pointId']; + $group->pin = $data['pin']; $group->startPoint = $data['startPoint']; - $group->active = $data['active']; + $group->active = $data['active']; return $group; } public function update(Group $group) { - $this->mapper->update([ - 'groupId' => $group->groupId, - 'gameId' => $group->gameId, - 'questId' => $group->questId, - 'pointId' => $group->pointId, - 'users' => json_encode($group->getUsers()), - 'pin' => $group->pin, - 'startPoint' => $group->startPoint, - 'active' => $group->active, - ]); + $this->mapper->update( + [ + 'groupId' => $group->groupId, + 'gameId' => $group->gameId, + 'questId' => $group->questId, + 'pointId' => $group->pointId, + 'users' => json_encode($group->getUsers()), + 'pin' => $group->pin, + 'startPoint' => $group->startPoint, + 'active' => $group->active, + ] + ); } }