i would like to ask if there is any method to render form for related data?
e.g
suppose we have a financial app. We could have Transactions and Categories (categories hasMany transactions).
Transaction Entity
id, amount, category_id
Category Entity
id, name
So far so good, but in the form i want to render an element (a select tag), so the user can select the categories form category model. Something like this:
<select name="demo"><option value="category_id">category_name</option>
Also,following the ORM mechanism, i set mapping like
$dbmap['Category']['has_many']['Transaction'] = array('foreign_key'=>'category_id');
$dbmap['Transaction']['belongs_to']['Category'] = array('foreign_key'=>'id');
I can build the form manually, i could create a function in category model (e.g get_categories) and then in the controller, just load the model and send the categories to the view. Is this the correct way? or there is a different, most appropriate way?