On Jun 17, 9:24 am, "b logica" <[EMAIL PROTECTED]> wrote:
> On Fri, Jun 13, 2008 at 8:34 PM, Tim Fisken <[EMAIL PROTECTED]> wrote:
> > this case. Odd as it might seem, it would be better, and more
> > consistent, if Cake produced an array like this:
>
> > $post['Comment'][0]['Comment']['author']
> > $post['Comment'][0]'Profile']['homepage']
>
> I disagree. I think that would cause much pain. Just imagine trying to
> iterate over such a structure. No thanks!
It would be _easier_ to iterate over a structure like this than the
current structure, because it's more consistent. If you had a function
like:
function print_comment($comment)
{
// Print out the comment
}
You could do something like:
$comments = $this->Comment->findAll();
foreach($comments as $comment)
{
print_comment($comment);
}
Or you could do:
$post = $this->Post->read(null, $id);
foreach($post['Comment'] as $comment)
{
print_comment($comment);
}
Right now, the format of the data is different in the two cases, so
you can't use the same print_comment function in both contexts, which
is, frankly, broken.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---