Anyone able to help me on this?

On May 18, 4:55 pm, bradmaxs <b...@pezzano.com> wrote:
> Hello All,
>
> In response to the following post:
>
> http://groups.google.com/group/cake-php/browse_thread/thread/c8ebc209...
>
> I have come up with my users having friends and admirers, thank you
> gentlemen for that.
>
> I am getting the array for both of them in my dump.
>
>     [friend] => Array
>         (
>             [0] => Array
>                 (
>                     [id] => 3
>                     [username] => artist
>
>                     [Friend] => Array
>                         (
>                             [id] => 1
>                             [user_id] => 4
>                             [friend_id] => 3
>                             [approved] => 1
>                         )
>
>                 )
>
>             [1] => Array
>                 (
>                     [id] => 5
>                     [username] => testing
>
>                     [Friend] => Array
>                         (
>                             [id] => 2
>                             [user_id] => 4
>                             [friend_id] => 5
>                             [approved] => 1
>                         )
>
>                 )
>
>         )
>
>     [admirer] => Array
>         (
>             [0] => Array
>                 (
>                     [id] => 5
>                     [username] => testing
>
>                     [Friend] => Array
>                         (
>                             [id] => 3
>                             [user_id] => 5
>                             [friend_id] => 4
>                             [approved] => 0
>
> My question, and I think it is simple but I am still a newbie for the
> most part -
>
> How do I combine that data in the view to have both friends and
> admirers as part of the same foreach statement?
>
> Is that possible?  I have looked at Set::merge and tried that from the
> controller.  Looked at custom query methods but the data is already
> there in an array so I am a little stuck.
>
> Here is what is in my view for the friends array and it is working
> fine.  Just don't know how to get the admirer as part of it.
>
> <?php foreach ($user['friend'] as $friend): ?>
> <?php echo $friend['username'];?>
> <?php echo $friend['created'];?>
> <?php echo $this->Html->link(__('View', true), array('controller' =>
> 'friends', 'action' => 'view', $friend['id'])); ?>
> <?php echo $this->Html->link(__('Delete', true), array('controller' =>
> 'friends', 'action' => 'delete', $friend['id']), null, sprintf(__('Are
> you sure you want to delete # %s?', true), $friend['id'])); ?>
> <?php endforeach; ?>
>
> Thanks for any help!
>
> Brad
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to