/** * @return Project */ public function getItem($id) { $this->transaction->requestTransaction(); $data = $this->conn->fetchAssoc('SELECT * FROM `' . CoreTables::PROJECT_TBL . '` WHERE `id` = :id', [':id' => $id]); if (null === $data) { $this->transaction->requestRollback(); throw new ItemNotFoundException('The specified item has not been found.', $id); } return Project::fromArray($data); }
/** * @return Area */ public function getArea($id) { $this->transaction->requestTransaction(); try { $item = Area::fetchByProject($this->conn, $id, $this->project); if (false === $item || $item->getStatus()->getId() != $this->publishedStatusId || $item->getProject()->getArchived()) { $this->transaction->requestRollback(); throw new ItemNotFoundException('The specified area has not been found.', $id); } return $item; } catch (Exception $exception) { $this->transaction->requestRollback(); throw $exception; } }
public function remove(ProjectForm $item) { $this->transaction->requestTransaction(); try { return $item->remove($this->conn); } catch (Exception $exception) { $this->transaction->requestRollback(); } }
public function remove(AppMail $item) { $this->transaction->requestTransaction(); try { return $item->remove($this->conn); } catch (\Exception $exception) { $this->transaction->requestRollback(); } }
/** * @return Course */ public function getCourse($id) { $this->transaction->requestTransaction(); $item = Course::fetchByProject($this->conn, $id, $this->project); if (false === $item) { $this->transaction->requestRollback(); throw new ItemNotFoundException('The specified item has not been found.', $id); } return $item; }
public function countParticipants() { $this->transaction->requestTransaction(); try { return $this->conn->fetchColumn('SELECT SUM(s.`participantNum`) + SUM(s.`externalParticipantNum`) ' . 'FROM `' . EdkTables::REGISTRATION_SETTINGS_TBL . '` s ' . 'INNER JOIN `' . EdkTables::ROUTE_TBL . '` r ON r.`id` = s.`routeId` ' . 'INNER JOIN `' . CoreTables::AREA_TBL . '` a ON r.`areaId` = a.`id` ' . $this->createWhereClause(), [':itemId' => $this->root->getId()]); } catch (Exception $ex) { $this->transaction->requestRollback(); throw $ex; } }
public function remove(Area $item) { $this->transaction->requestTransaction(); try { $item->remove($this->conn); } catch (Exception $exception) { $this->transaction->requestRollback(); throw $exception; } }
public function remove(GroupCategory $item) { $this->transaction->requestTransaction(); try { return $item->remove($this->conn); } catch (Exception $ex) { $this->transaction->requestRollback(); throw $ex; } }
public function pruneOld() { $this->transaction->requestTransaction(); try { $stmt = $this->conn->executeQuery('DELETE FROM `' . CoreTables::USER_REGISTRATION_TBL . '` WHERE `requestTime` < :time', [':time' => time() - self::PRUNE_PERIOD]); return $stmt->rowCount(); } catch (Exception $exception) { $this->transaction->requestRollback(); throw $exception; } }
public function confirmGoodFaithCompletion(Area $area, User $user, Course $course) { $this->transaction->requestTransaction(); try { $output = $course->confirmGoodFaithCompletion($this->conn, $area, $user); $this->spawnActivationEvent($area, $output); } catch (Exception $ex) { $this->transaction->requestRollback(); throw $ex; } }
public function remove(User $item) { $this->transaction->requestTransaction(); try { $item->remove($this->conn); $this->eventDispatcher->dispatch(CantigaEvents::USER_REMOVED, new UserEvent($item)); } catch (Exception $exception) { $this->transaction->requestRollback(); throw $exception; } }
public function update(Area $item) { $this->transaction->requestTransaction(); try { $item->update($this->conn); $this->eventDispatcher->dispatch(CantigaEvents::AREA_UPDATED, new AreaEvent($item)); } catch (Exception $exception) { $this->transaction->requestRollback(); throw $exception; } }
public function remove(AreaRequest $item) { $this->transaction->requestTransaction(); try { if (!$item->remove($this->conn)) { throw new ModelException('Cannot remove the specified area request.'); } } catch (Exception $exception) { $this->transaction->requestRollback(); throw $exception; } }
public function revoke(AreaRequest $item) { $this->transaction->requestTransaction(); try { if (!$item->revoke($this->conn)) { throw new ModelException('Cannot revoke this this request.'); } $this->eventDispatcher->dispatch(CantigaEvents::AREA_REQUEST_REVOKED, new AreaRequestEvent($item)); } catch (Exception $ex) { $this->transaction->requestRollback(); throw $ex; } }
public function revoke(EdkRoute $item) { $this->transaction->requestTransaction(); try { if (!$item->revoke($this->conn)) { throw new ModelException('Cannot revoke this this route.'); } $this->eventDispatcher->dispatch(MilestoneEvents::ACTIVATION_EVENT, new ActivationEvent($item->getArea()->getProject(), $item->getArea()->getEntity(), 'route.approved', $this->getActivationFunc($item))); } catch (Exception $ex) { $this->transaction->requestRollback(); throw $ex; } }
public function update(Project $project) { $this->transaction->requestTransaction(); try { $project->update($this->conn); if ($project->isPendingArchivization()) { $this->eventDispatcher->dispatch(CantigaEvents::PROJECT_ARCHIVIZED, new ProjectArchivizedEvent($project)); } } catch (\Exception $exception) { $this->transaction->requestRollback(); throw $exception; } }
public function removeMember(MembershipEntityInterface $item, User $user) { $this->transaction->requestTransaction(); try { if ($item->removeMember($this->conn, $user)) { return ['status' => 1, 'data' => $item->findMembers($this->conn, $this->roleResolver)]; } return ['status' => 0, 'data' => $item->findMembers($this->conn, $this->roleResolver)]; } catch (Exception $exception) { $this->transaction->requestRollback(); throw $exception; } }
/** * @param $membershipEntity Entity whose members we want to view * @param $id User ID * @return User */ public function getItem(MembershipEntityInterface $membershipEntity, $id) { $this->transaction->requestTransaction(); try { $user = User::fetchLinkedProfile($this->conn, $this->roleResolver, $membershipEntity, Join::create($this->membershipTable(), 'm', QueryClause::clause('m.userId = u.id')), QueryOperator::op('AND')->expr(QueryClause::clause('m.' . $this->entityColumn() . ' = :entityId', ':entityId', $membershipEntity->getId()))->expr(QueryClause::clause('u.`id` = :userId', ':userId', $id))); if (false === $user) { throw new ItemNotFoundException('The specified user has not been found.'); } return $user; } catch (Exception $exception) { $this->transaction->requestRollback(); throw $exception; } }
public function revoke($id, User $user) { $this->transaction->requestTransaction(); try { $item = Invitation::fetchByUser($this->conn, $id, $user); if (empty($item)) { throw new ItemNotFoundException('The specified invitation cannot be found.'); } $item->remove($this->conn); } catch (Exception $exception) { $this->transaction->requestRollback(); throw $exception; } }
public function changeDuplicateFlag(EdkMessage $item) { $this->transaction->requestTransaction(); try { if ($item->getDuplicate()) { $item->setDuplicate(false); } else { $item->setDuplicate(true); } $item->changeState($this->conn); } catch (Exception $ex) { $this->transaction->requestRollback(); throw $ex; } }
public function isAllowed(Entity $entity, MembershipEntityInterface $who, $editable = false) { $this->transaction->requestTransaction(); try { if ($who instanceof Project) { return $this->isAllowedForProject($entity, $who, $editable); } elseif ($who instanceof Group) { return $this->isAllowedForGroup($entity, $who, $editable); } elseif ($who instanceof Area) { return $this->isAllowedForArea($entity, $who, $editable); } throw new LogicException('Unsupported type of entity!'); } catch (Exception $exception) { $this->transaction->requestRollback(); throw $exception; } }