/** * @return EdkRegistrationSettings */ public function getItem($id) { $this->transaction->requestTransaction(); try { $route = EdkRoute::fetchByRoot($this->conn, $id, $this->root); if (empty($route)) { throw new ItemNotFoundException('The specified route has not been found.'); } return EdkRegistrationSettings::fetchByRoute($this->conn, $route); } catch (Exception $ex) { $this->transaction->requestRollback(); throw $ex; } }
/** * Fetches the participant by his/her ID and area. * * @param Connection $conn * @param int $id * @param Area $area * @param boolean $forUpdate Whether to lock the registration settings for writing * @return EdkParticipant */ public static function fetchByArea(Connection $conn, $id, Area $area) { $data = $conn->fetchAssoc('SELECT * FROM `' . EdkTables::PARTICIPANT_TBL . '` WHERE `id` = :id AND `areaId` = :areaId', [':id' => $id, ':areaId' => $area->getId()]); if (false === $data) { return false; } $route = EdkRoute::fetchByRoot($conn, $data['routeId'], $area); if (empty($route)) { return false; } $registrationSettings = EdkRegistrationSettings::fetchByRoute($conn, $route); if (empty($registrationSettings)) { return false; } $item = EdkParticipant::fromArray($data); $item->setRegistrationSettings($registrationSettings); return $item; }