Skip to content

Commit

Permalink
issue #122 Undefined index: startPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
irvis committed Oct 25, 2016
1 parent 626d35a commit 545e3db
Showing 1 changed file with 39 additions and 32 deletions.
71 changes: 39 additions & 32 deletions src/Kubikvest/Manager/GroupManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,58 +28,65 @@ 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)
{
$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,
]
);
}
}

0 comments on commit 545e3db

Please sign in to comment.