Actually that's wrong. If this was a pure OOP framework, then we would
be passing the model or some kind of object to the view, but we are
not since Cake uses array as its primary data structure.

Say you had a method like this in your User model:

public function isActive() {
        return $this->data['User']['active'] == User::STATUS_ACTIVE;
}

Then all you would need to do in the view is:

if ($model->isActive())

That cuts out the whole problem of having to manually write that
condition every time its used. It also cuts out the need of a helper
that handles this function when its unnecessary.

Furthermore, Cake models are used incorrectly in my opinion. Models
should represent a single entity of data (getters and setters for a
row in the database), while Cakes approach is a global model to
database table relation.

On Nov 16, 3:28 pm, cricket <[email protected]> wrote:
> On Tue, Nov 16, 2010 at 5:22 PM, Miles J <[email protected]> wrote:
> > @Cricket - How so? Just because the model has database access? It
> > really doesn't matter if you pass the model to the view if you are
> > using it for convenience methods. I think you are completely missing
> > the point, this isn't about passing data to the view.
>
> Not sure I understand what you mean, either. Not providing a model (by
> default) to the view is a design decision based on "separation of
> concerns" (google it). In a well-designed MVC framework, it not only
> isn't necessary but would likely also be detrimental. And the point I
> was trying to make is that having a model available for "convenience
> methods" is no different from having it available for DB writes. ...
> Which goes against the principles of the MVC pattern. IOW, this isn't
> a "those Cake devs and their crazy notions" thing, but borne of a
> decision to utilise the MVC pattern.
>
> However, as Andy will remind us, "it's just PHP", and so it's a simple
> matter to shoot oneself in the foot if one wants.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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