0

I have a project about nurse and patients. Nurse goes around and visits patients. The problem that I'm facing is that the nurse wants to see a list of all the visits they did for a patient.

I do have two admin pages, one is the patients admin (allows to create/edit patients) and another one that allows to log visits. Within the visit you select the patient. From the patient list, how can I list all of the visits a nurse did for a patient? and further more, allow to click an add button to log a new visit.

I don't have code to show, but if any of you can point to some documentation, or sample code, will be much appreciated.

CookieMonster
  • 73
  • 1
  • 9

1 Answers1

1

On the patient edit page you could do the following. Assuming your entity is called something like VisitLogs. You can add the following to configureFormFields

$formMapper->Add('VisitLogs', 'sonata_type_collection' ['type_options' => ['btn_add' => true]], ['inline' => 'table', 'edit' => 'inline']);

This should display a table with the Visitlogs based on the patients (if the ORM is correctly setup) and shows a add new button.

I hope this somewhat helps you a little bit further. More information.

Note This is for the one-to-many relation. I'm guessing for the many-to-one relation you should use sonata_type_model not sure about that though.

Community
  • 1
  • 1
Simon Brink
  • 107
  • 9
  • If this is the answer you were looking for please mark it as answer, if not then I hope the link did help you out! – Simon Brink Apr 11 '18 at 14:07