I've been using CakePHP for a few projects and really think it's a
great frameworks except one thing. I can't get my head around why all
results have the model name in the associative array. I don't see any
benefit of doing this. If you're trying to get a Post object and you
do: $post = $this->Post->find()

why should you have to access the variables like: $post['Post']
['title'] instead of $post['title']

It's overly verbose and redundant, and adds no benefit. It makes a
little more sense in a hasMany association but even then, I don't
think it's optimal. If you have a Post that has many Comments. It
seems more logical to me to have the following structure: $post =
$this->Post->find()

$post => array('title' => 'post title', 'author' => 'john doe',
'comments' => array(0 => array('body' => '...a comment..')))

where the comments array is used like an instance variable of the Post
object.

I'm curious if there is a way to implement this, possibly using
afterFind to modify the results in AppModel? I'm also wondering why it
was implemented like this and there is some benefit or use case I'm
not seeing.

Thanks,
zw

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