Re: Using Multiple Models in a Controller?
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- > > >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 cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using Multiple Models in a Controller?
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 cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using Multiple Models in a Controller?
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 you want to access Customer model in > employees_controller ? > > just add : > var $uses = array('Customer'); > or > var $uses = array('Employee', 'Customer'); > > On Jan 7, 2:00 am, Travis <[EMAIL PROTECTED]> wrote: > > > 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 lists all customers ,so that in the Employee/index file I can > > generate a dropdown to select the customer to sort the data by. > > > I haven't been able to find any examples of something like this > > anywhere I have looked. > > > Any help would be appreciated. > > > Travis --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using Multiple Models in a Controller?
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 $uses = array('Employee', 'Customer'); On Jan 7, 2:00 am, Travis <[EMAIL PROTECTED]> wrote: > 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 lists all customers ,so that in the Employee/index file I can > generate a dropdown to select the customer to sort the data by. > > I haven't been able to find any examples of something like this > anywhere I have looked. > > Any help would be appreciated. > > Travis --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---