Hi everybody

Something I don't really like in CakePHP is that one seems to be
always only working with the $data array instead of "real" model
instances. I hate to name Ruby on Rails again, but in RoR, I normally
pass a model instace to a view, and there I can do handy stuff like
calling methods on that model etc.

But in CakePHP it seems normal to only pass the $data of the model. So
I can't call any methods on it.

For example, I have a Medium (e.g. a book) model that can be rent. It
has a method isRent():

function isRent() {
  return !empty($this->data['Medium']['rent_user_id']);
}

So when the rent_user_id is empty, the medium is rent to that user.

It would be really handy to use this method also in a view, but it
seems I can't. Is the only solution to set another parameter for the
view, like so?

$this->set('isRent', $model->isRent());

Thanks for help
Josh

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