On Oct 13, 12:21 am, "nate" <[EMAIL PROTECTED]> wrote:
> The short answer is no.  Allowing the view to query model objects
> directly violates the basic tenents of MVC separation, so although Cake
> 2.0 will support a fully object-based ActiveRecord implementation, this
> will likely never be supported.

Thanks for the reasonable answer, this makes much sense for shure.
Maybe I'm really misunderstanding some basics of MVC, so I'd like to
clear things up.

Model object (that acts more like a DAO in case of Cake) returns raw
data which is handled by controller to the view. So it's completely
legal to access the data in this style: $model_object['NAME']. But in
OO code this would be done by using an accessor like
$model_object->get_name(). I wonder if it would be legal (if it was
possible) according to MVC, as the last thing does exactly the same -
it provides access to data. And even in more structured way, because it
gives only read access to it. And to make things even worse, let us
assume that view accesses the data by call
$model->get_attribute('NAME'). Does this violates MVC? I'm sad to think
that answer is yes. Because upfront planning of data a view needs leads
to hard coupling of C-V, breaks model incapsulation and creates
redundant model data. By hard coupling I mean strictly knowing in
controller what part of the model and in what perspective the view
renders, instead of just giving model object to any view that needs it
never caring of which particular data it would render. The approach to
solve this problems in rails, as I know, is providing convinient data
access methods in model that "talk" on problem domain language. That
keeps logic close with data that it works with, and looks like a good
incapsulation, I think.


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

Reply via email to