mapper = $mapper; } private function handleException ($e) { if ($e instanceof DoesNotExistException || $e instanceof MultipleObjectsReturnedException) { throw new NotFoundException($e->getMessage()); } else { throw $e; } } //Find an Agency public function find(int $id) { try { return $this->mapper->find($id); } catch(Exception $e) { $this->handleException($e); } } //Create an Agency public function create(string $gid, string $permission = "") { $grouppermission = new GroupPermission(); $grouppermission->setGid($gid); return $this->mapper->insert($grouppermission); } public function findbygid(string $gid){ try { return $this->mapper->findbygid($gid); } catch(Exception $e) { $this->handleException($e); } } public function remove(string $gid){ try { return $this->mapper->remove($gid); } catch(Exception $e) { $this->handleException($e); } } }