I read much about how great containable is. Honestly I have read all docs, I have it working in my Users controller, but some things are not clear:
- Do I have to use it in All actions or only in Index()?
- Do I have to define it in every controller index() function or is it enough to it once in the Users controller
What about if e.g. Country_ID is a FK connected to both user and a related model? For example:
function index() { $this->paginate = array( 'limit'=>10, 'order'=>'User.created DESC', 'fields'=>array('User.id','User.name', 'User.country_id', 'User.email'), 'contain'=>array( 'Post', 'Company' => array( 'Country' => array( 'fields' => array('id', 'country') ) ), 'Position' => array( 'Profession' ), 'Preference', 'Country', 'Type' ), ); $this->set('users',$this->Paginate('User'));
}
Country is both connected to User and Company. How to define this without creating duplicates?
Many thanks!