It's a notation used by the Set class.  Here's an explanation for you,
taken from the comments for this post over at "ThinkingPHP and
beyond":

http://www.thinkingphp.org/2007/02/24/cake-12s-set-class-eats-arrays-for-breakfast/

"{n} indicates that any numerical key will be matched and looped
through. Sample:

$a = array('User' => array(0 => array('name' => 'Jim'), 1=>
array('name' => 'Bob')));
$b = Set::extract($a, 'User.{n}.name');

is the same as:

$b = array('Jim', 'Bob');"

So, if you have, say, a result set from a findAll() call that contains
associated data from model A, B anc C you can pull out just the info
that you want by doing the following:

$foo = Set::extract('{n}.A.bar');

That will populate $foo with an array containing all the A.bar values
from your result set.  Set::extract is a very powerful tool for
dealing with nested arrays, replacing several levels of foreaches with
one nice call.

Hope that helps.

On 7/13/07, Feris Thia <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> What is {n}.Model.field used for ? I find it in generatelist function.
>
> Regards,
>
> Feris
>
> >
>


-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

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