{n} represents the numeric index. For example, if you do a findAll(),
your result array could be like this:
array(
[0] => array('Person' => array('name' => 'Caramon', 'class' =>
'Fighter', 'note' => 'Fat drunk')),
[1] => array('Person' => array('name' => 'Sturm', 'class' =>
'Paladin', 'note' => 'Pompous git')),
[2] => array('Person' => array('name' => 'Raistlin', 'class' =>
'Mage', 'note' => 'Defeated the Queen of Darkness and took her
place'))
)
In cakephp-set format, this would be "0.Person.name",
"0.Person.class", ...
So `{n}.Person.name` would evaluate to array('Caramon', 'Sturm',
'Raistlin') and `{n}.Person.class` would be array('Fighter',
'Paladin', 'Mage')
Finally, $this->Person->generateList(null, null, null,
'{n}.Person.class', '{n}.Person.name') would generate the following
array:
array(
'Fighter' => 'Caramon',
'Paladin' => 'Sturm',
'Mage' => 'Raistlin'
)
Hope this makes sense.
On Jan 17, 4:10 pm, Raistlin Majere <[EMAIL PROTECTED]> wrote:
> CakePHP 1.1.19.6305
> MySQL 4.1.9
> PHP 4.3.10
>
> At the chapter models of the CakePHP Manual, there is an example of a
> function "to generate a list of roles based on your Role model, keyed
> by their integer ids" The function is generateList and (n) is used
> twice in its parameters. What is {n}?
>
> $this->Role->generateList(null, 'role_name ASC', null, '{n}.Role.id',
> '{n}.Role.role_name')
>
> -http://manual.cakephp.org/chapter/models
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---