/** * @Route("/job/{id}/notes", name="job_show_notes") * @Method("GET") */ public function getNotesAction(Job $job) { // To remember: "git grep job_show_notes" // END. To remember $notes = []; foreach ($job->getNotes() as $note) { $notes[] = ['id' => $note->getId(), 'username' => $note->getUsername(), 'avatarUri' => '/images/' . $note->getUserAvatarFilename(), 'note' => $note->getNote(), 'date' => $note->getCreatedAt()->format("Y-m-d")]; } $data = ['notes' => $notes]; return new JsonResponse($data); }