I am new to yii and the mvc programming architecture and trying to create some database application with various tables and admin pages.
I have created some models and crud pages with the yiic and i am now at the point to make my modifications and extensions to the generated code.
My problem is I have a address table with many address entries.
Each address can has a company_id wich is a foreign key in the company table.
So my point it how can I modify the code to easily create the selection of the company in a address entry on the admin update form for a selected address.
Sadly I have that many entries in both tables (address and company) so that i can't do an easy select element.
What I need is a button which possibly opens a view where all the companies are displayed in a table and also be search for. And on a click of a link or another button on the select page my company_id is given back to the admin form of the address.
My questions are how would you program this in mvc with yii?
- would you create a separate controller for the company selection?
(a controller class for the company and address table is created with crud)
or add this code to either the company or address controller class ?
or create something with ajax?
and add the code also into the update view code for the address table
I also wonder how the whole stuff will be called and how the input is given back to the right page.
Also how should the whole thing be accessible via url?
my update url ist currently like this
should the company selection for the address entry with the id =11 have the url like:
or should it be more like
to use the mvc design correctly?
thx in advance for any hints regards Horizons