Thursday, September 3, 2009

Using two models in one controller, paginating data from both

Hello everyone.

I have a simple question.

I have a controller ('membersController') that must use 2 models ('member'
and 'category'). A category hasMany members.

When adding a member, I must choose the category it belongs to in my Add
view. To paginate data from the Member model is simple, just
$this->set('members', $this->paginate());
But the problem is, I can't get the data from the Category model in my
MembersController so that the admin can just select one among all categories
available.

I tried using, in my membersController:

var $uses = array('Member ', 'Category')

But in the add function, what must i use insted of $this->set('categories',
$this->paginate()); ?

Thanks!
--
View this message in context: http://www.nabble.com/Using-two-models-in-one-controller%2C-paginating-data-from-both-tp25285302p25285302.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: