Using Multiple Models in a Controller?

2008-01-06 Thread Travis
Hi everyone, I have two models, Employee and Customer. Employee belongsTo Customer. I want to have a view Employee/index/customer_id where I can have a table view of all employees that belong to a certain customer. How would I go about calling the Customer Model to genrate a data set that

Re: Using Multiple Models in a Controller?

2008-01-06 Thread polutan
add this in your controller var $uses = array('Model2','Model3'); or if not working try to var $uses = array('YourCurrentModelName','Model1','Model2','Model_etc'); for your case. did you want to access Customer model in employees_controller ? just add : var $uses = array('Customer'); or var

Re: Using Multiple Models in a Controller?

2008-01-06 Thread Travis
Thanks. I was able to get it. That helped alot!!! On Jan 6, 1:57 pm, polutan [EMAIL PROTECTED] wrote: add this in your controller var $uses = array('Model2','Model3'); or if not working try to var $uses = array('YourCurrentModelName','Model1','Model2','Model_etc'); for your case. did

Re: Using Multiple Models in a Controller?

2008-01-06 Thread gwoo
No you do not need var $uses if you have associations. $this-Employee- Customer will work just fine. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to

Re: Using Multiple Models in a Controller?

2008-01-06 Thread Travis
Hey gwoo, you are right. I had commented out an association in my customer_model, when I uncommented it and took out the var $uses, it still worked. thanks for the help On Jan 6, 5:53 pm, gwoo [EMAIL PROTECTED] wrote: No you do not need var $uses if you have associations. $this-Employee-