To me "Hierarchical Model View Controler pattern." makes sense. I understand (some) database logic (so objects, ORM etc...) but when I think of a website I think with page-logic (so hierarchy, tree, etc). That's the reason why I made Chameleon, and I guess Ocean had similar motivations for OceanCMS. Greywire what you are looking for can be done with Cake. OceanCMS uses the powerful MPTT tree structure and has other powerful features. Altough it is not compatible with the lasts version of cake it is a 98% finished application. In chameleon (my project) I used a simpler (lazy) approach, agot my stuffs running pretty quickly, I'm quite confident in its stability (if u test use SVN not the package), and could let cake do the nasty job and let me concentrate on the surface of the app to make it easy to use. My code has nothing amazing, and the recipe is simple. Build your tree structure in your model (there is different approaches, MPTT, adjacency,...) and use requestAction in your "main" controller to get what you need from other controllers, i.e from other objects. olivvv John David Anderson (_psychic_) wrote: On Jul 10, 2006, at 4:44 PM, [EMAIL PROTECTED] wrote:I doing research for a new framework for my project, I came across the concept of the Hierarchical Model View Controler pattern. I've only found one php framework that claims to support this (Claw). It makes a whole lot of sense to me and I was wondering if Cake supported this (or could it be extended easily if I needed to). If this is unfamiliar concept, it means basicaly that you can easily embed MVC "components" inside one another. Part of what makes this work is a method for chaining them together and allowing you to specify on the URL arguments for multiple components. So if you had a page that contained an MVC component for "Lead" and one for "Notes", you could do things like this: http://domain.com/view.php/lead/id.123/notes/page.2 which would give you the lead of id 123 with the second page of notes. Does that make any sense?Not to me, at least. :)The other concern I have is with how Cake interfaces to the database. I've always thought it didnt make a lot of sense to directly map objects to the database -- they just arent the same thing, after all. After reading some articles on it, I realize I am not the only one to think this.I've always thought of database tables as objects that relate to an application. Some tables arent (like join tables), but for the most part, a table should reflect an object or domain in your application. That's why they call them RDBMS's after all, but everyone looks at things differently.I figure for 90% of my project, the typical Object Relational Mapping method would probably work fine, to create the CRUD type pages needed. But that last 10% would be a total bitch to create. This is the same problem I have with Codecharge Studio.What sort of things are happening in the 10%?It seems to me that the best method would be not to try and make everything in teh database into an object, and maybe use a combination of objects and list processing (after all, database tables are just lists/sets of data, not objects).Well, Cake actually returns results in array form right now.So for example, in cake, is it goign to create an object for every row I fetch from the database?No. It will create an object that fetches data from your store, though.How easy is it to customize if I want to have my object for a table but internaly it manages the rows as an array?You can always override (or extend) methods or write your own model methods if you want to. Its all OOP. Besides, I think Cake returns data how you'd like. Have you used it yet?Can cake create "smart" SQL queries that will pull all the data needed in one query that ends up as several objects?Not sure what you mean by "smart", but models can be associated in Cake. So if I tell it my Supervisor hasMany Peons, bringing up a Supervisor record could automagically bring up its associated Peon records as well. -- J --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~--- |
- Re: How do Models work in Cake Olivier Percebois-Garve
- Re: How do Models work in Cake John David Anderson