> I can't see any reason why you wouldn't want to model a view. As far as
> SQL is concerned, views can be treated just like any other table. So
> all of the fancy helper methods should work the same on views as they
> do on tables.

I agree on general principle.  My question is about the wisdom of using
db views within cake because it breaks the relationship model (for the
want of a better term).  And I'm not sure how good or bad that is.

Let me explain.  You have a table.  Say 'users'.  you have a model
called User, a controller called UsersController and views for each
action.  The UsersController "uses", say, the Profile, in addition to
the User, model to allow cake to get associated an profile.  It might
also "use", say, a model called Skill to get a users associated skills.
 This is all well and good.  And when you use, say, findAll(), you are
returned an array of all the related data.  Ok.  So if you wanted to
show an index view of the users in the db, the UsersController would
use it's own model to retrieve all that data.  I hope I'm not being too
convoluted here but I think I am.

In any case, but modeling and using the database view set up to
aggregate all the user information (which may include joined data from
the skills and/or profiles tables), the UsersController is no longer
using it's own model.  It's using a 'virtual' (for the want of a better
word) model that is _based_ on the users table but isn't a direct
representation of the data within that table.

I'm just not sure if this goes outside the theoretical structure that
is MVC.  A model uses a controller (and vice versa) to create a
presentation.  By using a db view, you essentially have X models (the
various db views) using a controller to create a presentation.  And
again, being so new to MVC, I'm not sure if this is straying beyond
those theoretical boundries.

I hope I'm making sense.

thnx,
Christoph


--~--~---------~--~----~------------~-------~--~----~
 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to