/** * @Route("/ajax-update", name="area_note_ajax_update") */ public function ajaxUpdateAction(Request $request) { try { $i = $request->get('i'); $c = $request->get('c'); if (empty($c)) { $c = null; } $areaNotes = EdkAreaNotes::fetchNotes($this->get('database_connection'), $this->getMembership()->getItem()); $areaNotes->saveEditableNote($this->get('database_connection'), $i, $c); return new JsonResponse(['success' => 1, 'note' => $areaNotes->getFullEditableNote($this->getTranslator(), $i)]); } catch (Exception $ex) { return new JsonResponse(['success' => 0]); } }
/** * Fetches a pair of two objects: participant and area notes, where the participant is registered for the route. * The access key is used for finding the record. * * @param string $accessKey Access key generated during registration * @param int $expectedAreaStatus Status of the published areas. * @return array * @throws \WIO\EdkBundle\Repository\Exception * @throws ItemNotFoundException */ public function getItemByKey($accessKey, $expectedAreaStatus) { $this->transaction->requestTransaction(); try { $item = EdkParticipant::fetchByKey($this->conn, $accessKey, $expectedAreaStatus, false); if (false === $item) { throw new ItemNotFoundException('Participant not found.'); } $notes = EdkAreaNotes::fetchNotes($this->conn, $item->getRegistrationSettings()->getRoute()->getArea()); return [$item, $notes]; } catch (Exception $ex) { $this->transaction->requestRollback(); throw $ex; } }