Sunday, April 17, 2011

Re: Tr.lời: Re: When need to use Set::combine ?

On Sun, Apr 17, 2011 at 4:46 PM, Điển vũ <meotimdihia@gmail.com> wrote:
> It may be 2 question : when use Set::combine and  extract this data :
> $this->User->find('all);
>
> Array
> (
> [0] => Array
> (
> [User] => Array
> (
> [id] => 4
> [username] => myname
> [password] => abc
> )
> )
> [1] => ...
> [2] => ...
> )
>
> )
>
> to
>
> Array(
>   'myname'=>array(
>         'id'=>1,
>         'password'=>'abc'
> }

Because you're starting with an array of many Users, it would have to
be more like:

array(
array(
'myname'=>array(
'id'=>1,
'password'=>'abc'
)
),
array(
'othername'=>array(
'id'=>2,
'password'=>'def'
)
),
...
)

But I don't know how you'd do that with the Set class, sorry.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate