Your comments have indeed helped to clarify things, MX. I'm going to digest the ideas that all of you have offered. Thank you all.
When I started this project, I put all the methods for both Projects and Roles in one controller "Industry". It works but has bothered me. I'll do the next project differently. Peter - On Feb 12, 7:31 pm, MX <[EMAIL PROTECTED]> wrote: > The probem with your concept is very simple, and dont be ashme to be > new. We all were at some point. :D > > The problem is that in Cake each controller should have the CRUD > (Create, Read, Update, Delete) functions for A model. > You have an Industry controller. Industry in your case should be your > application. > > You now have to create at least two controllers: Projects, Roles. > Each of these will control homonymous Model. > > You can use bake (command line which comes with Cake) to produce the > Models and Controllers for you. > > Hope I cleared out something. > > On Feb 13, 2:14 am, peterhf <[EMAIL PROTECTED]> wrote: > > > I have a controller called "Industry". In Industry, I have methods > > that create, edit and delete "Projects", the data for which are stored > > in the "projects" table modeled by the "Project" model. In Industry I > > also have methods that create, edit and delete "Roles", the data for > > which are stored in the "roles" table modeled by the "Role" model. > > There are many other methods in the Industry controller which do > > similar things. Therefore, I have a long string in $user = <string>; > > > BTW, I am sure that it is obvious that I am new to CakePHP. This > > dialog is most helpful to me. > > > Peter - > > > On Feb 12, 5:13 pm, "Renan Gonçalves" <[EMAIL PROTECTED]> wrote: > > > > Thequestionthat must be made is: why you have a controller that includes > > > many models? > > > > A controller, in principle, must deal with all the operations of only one > > > model. > > > You can have many models but on the same controller, but they should have > > > relations with the model. So if you do not have relations need to use the > > > $uses, if have relations you can access the models by > > > $this->Model1->RelationedModel1-> doAnything (). > > > > It is how I think and how I do. > > > > []'s > > > > On Feb 12, 2008 10:45 PM, peterhf <[EMAIL PROTECTED]> wrote: > > > > > My questions are motivated by the fact that I have a controller which > > > > includes a sizable number of methods. The result is that I must have a > > > > long list of Models at the beginning of the class. It is often the > > > > case that there is a method that only stores data from an input view > > > > and then either "$this->render()"s a new view or "$this->setAction()"s > > > > another method in the same controller which displays a new view. I > > > > thought that calling a method in another controller might be more > > > > efficient. > > > > > On Feb 12, 4:29 pm, "b logica" <[EMAIL PROTECTED]> wrote: > > > > > On Feb 12, 2008 7:18 PM, peterhf <[EMAIL PROTECTED]> wrote: > > > > > > > Hello All, > > > > > > >PhilosophicalQuestion: > > > > > > > If my application requires a large number of methods is it "better" > > > > > > to > > > > > > include them all in one controller or is it "better" to put each > > > > > > method, or at least a small number of related methods, in individual > > > > > > controllers? > > > > > > I think it would depend, for one thing, upon whether the methods are > > > > > used by many different controllers or not. Common convenience > > > > > functions can be placed in bootstrap.php to make them globally > > > > > available. > > > > > > > PracticalQuestion: > > > > > > > If the methods are in individual controllers, how do I call a method > > > > > > in controller "A" from controller "M"? Controller "M" stores some > > > > > > data, for instance, and controller "A" displays a view. > > > > > > Perhaps you'd be better off creating a number of components that a > > > > > controller can load as necessary. > > > > -- > > > Renan Gonçalves - Software Engineer > > > Cell Phone: +55 (11) 8633-6018 > > > MSN: [EMAIL PROTECTED] > > > Web Site: renangoncalves.com > > > São Paulo - SP/Brazil --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
