Upload File And Relational Model


In advance, sorry for my English. I’m an italian guy, who approaches this framework.

This is my problem:

My dB consists in 3 tables:

  • Customers

  • Doctors

  • reports

having the following relations:

Doctors(1) --> (many) Customers (1) —> (many) Reports

and the key are:

id_doctor —> Customers.id_doctor

Customers.id —> Reports.id_customers

everything is working properly with the CRUD generated by Yii (Gii).

I need, from the customer detail screen (clienti.jpg), by clicking on the side menu "New report", to access the entry screen reports (referti.jpg). Currently click on "new report" redirect the user to the link "/Reports/index.php/reports/create/91" where 91 is the Customer_id.

Now I think the controller reports (actionCreate), should do all the work.

So how do I upload the report (pdf) and historicize info (linked to customer) and link of pdf into db?

Thank you all for the answers.

PS: I have attached the images