Simple, if it is a related model in your controller, you pass a list to find (); the cake will make an id => array of values ββfor you, and the form helper will know exactly what to do with it.
For example, say you want to get a list of categories for a product model, this is in your contoller:
$categories = $this->Product->Categories->find('list'); $this->set(compact('categories'));
Then, in your view using the form helper, simply create a select element, as you would normally type:
$form->input('category_id');
The form assistant will automatically load the $ categories variable that we set using $ this-> set ().
source share